Skip to content

Feat: Add option for generating docs without examples (#830) #4131

Feat: Add option for generating docs without examples (#830)

Feat: Add option for generating docs without examples (#830) #4131

GitHub Actions / Test Report 3.11 failed Jul 26, 2024 in 0s

23 tests run, 20 passed, 2 skipped, 1 failed.

Annotations

Check failure on line 134 in tests/embedding/test_qk_eng_wb2.py

See this annotation in the file changed.

@github-actions github-actions / Test Report 3.11

test_qk_eng_wb2.test_qk_eng_wb2_007

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <e85874d36dd54c51a7dcd93d72f2c404>:0 
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <e85874d36dd54c51a7dcd93d72f2c404>:0
Raw output
printer = <bound method State.printer of <pytest_print.State object at 0x7f1380308dc0>>
selection = <conftest.selection.<locals>.Selection object at 0x7f1380300a10>
embedded_app = Ansys Mechanical [Ansys Mechanical Enterprise]
Product Version:251
Software build date: 07/24/2024 21:16:17

assets = PosixPath('/__w/pymechanical/pymechanical/tests/assets')

    @pytest.mark.embedding
    def test_qk_eng_wb2_007(printer, selection, embedded_app, assets):
        """Fatigue.
    
        From Mechanical/QK_ENG_WB2/QK_ENG_WB2_007
        """
        embedded_app.update_globals(globals())
        printer("Setting up test - adding two static structural systems")
        Model.AddStaticStructuralAnalysis()
        Model.AddStaticStructuralAnalysis()
        geometry_file = os.path.join(assets, "longbar.sat")
        printer(f"Setting up test - attaching geometry {geometry_file}")
        geometry_import = Model.GeometryImportGroup.AddGeometryImport()
        geometry_import.Import(geometry_file)
        material_file = os.path.join(assets, "eng200_material.xml")
        printer(f"Setting up test - import materials {material_file}")
        shims.import_materials(embedded_app, material_file)
    
        def _innertest():
            printer("Add material file")
            MODEL = Model
            MODEL.RefreshMaterials()
            MODEL.Geometry.Children[0].Material = "eng200_material"
    
            printer("Setup Mesh")
            MSH = MODEL.Mesh
            MSH.Resolution = 4
    
            printer("Apply loads")
            STAT_STRUC1 = MODEL.Analyses[0]
    
            selection.UpdateSelection(ExtAPI, [29], SelectionTypeEnum.GeometryEntities)
            FIX_SUP = STAT_STRUC1.AddFixedSupport()
    
            ExtAPI.SelectionManager.ClearSelection()
            selection.UpdateSelection(ExtAPI, [28], SelectionTypeEnum.GeometryEntities)
            FRC = STAT_STRUC1.AddForce()
            FRC.DefineBy = LoadDefineBy.Components
            values = System.Collections.Generic.List[Quantity]()
            values.Add(Quantity("0 [N]"))
            values.Add(Quantity("1000000000 [N]"))
            FRC.YComponent.Output.DiscreteValues = values
    
            printer("Add Results and Solve")
            SOLN_STAT_STRUC1 = STAT_STRUC1.Solution
            SHEAR_STRS1_STAT_STRUC1 = SOLN_STAT_STRUC1.AddShearStress()
            SHEAR_STRS1_STAT_STRUC1.ShearOrientation = ShearOrientationType.YZPlane
            SHEAR_STRS2_STAT_STRUC1 = SOLN_STAT_STRUC1.AddShearStress()
            SHEAR_STRS2_STAT_STRUC1.ShearOrientation = ShearOrientationType.XZPlane
            SOLN_STAT_STRUC1.Solve(True)
    
            printer("Apply loads for Static 2 ")
            STAT_STRUC2 = MODEL.Analyses[1]
    
            ExtAPI.SelectionManager.ClearSelection()
            selection.UpdateSelection(ExtAPI, [29], SelectionTypeEnum.GeometryEntities)
            FIX_SUP2 = STAT_STRUC2.AddFixedSupport()
    
            ExtAPI.SelectionManager.ClearSelection()
            selection.UpdateSelection(ExtAPI, [28], SelectionTypeEnum.GeometryEntities)
            FRC2 = STAT_STRUC2.AddForce()
            FRC2.DefineBy = LoadDefineBy.Components
            values = System.Collections.Generic.List[Quantity]()
            values.Add(Quantity("0 [N]"))
            values.Add(Quantity("1000000000 [N]"))
            FRC2.XComponent.Output.DiscreteValues = values
    
            printer("Add Results and Solve")
            SOLN_STAT_STRUC2 = STAT_STRUC2.Solution
    
            SHEAR_STRS1_STAT_STRUC2 = SOLN_STAT_STRUC2.AddShearStress()  # YZ stress
            SHEAR_STRS1_STAT_STRUC2.ShearOrientation = ShearOrientationType.YZPlane
            SHEAR_STRS2_STAT_STRUC2 = SOLN_STAT_STRUC2.AddShearStress()  # XZ stress
            SHEAR_STRS2_STAT_STRUC1.ShearOrientation = ShearOrientationType.XZPlane
            SOLN_STAT_STRUC2.Solve(True)
    
            ExtAPI.SelectionManager.ClearSelection()
            printer("Insert Solution Combination 1")
            SOLN_COMB = MODEL.AddSolutionCombination()
            SOLN_COMB.Activate()
    
            printer("Insert Solution Combination2")
            SOLN_COMB.Definition.AddBaseCase()
    
            printer("Insert Solution Combination 3")
            SOLN_COMB.Definition.SetCoefficient(0, 0, 1)
            printer("Insert Solution Combination4")
            SOLN_COMB.Definition.SetBaseCaseAnalysis(0, STAT_STRUC1)
            printer("Insert Solution Combination5")
            SOLN_COMB.Definition.SetCoefficient(0, 1, 1)
            printer("Insert Solution Combination6")
            SOLN_COMB.Definition.SetBaseCaseAnalysis(1, STAT_STRUC2)
    
            printer("Add and Setup Fatigue Tool 1")
            FAT_TOOL1 = SOLN_COMB.AddFatigueTool()
            FAT_TOOL1.LoadingType = FatigueLoadType.NonProportional
            FAT_TOOL1.MeanStressTheory = MeanStressTheoryType.Goodman
            FAT_TOOL1.StressComponent = FatigueStressComponentType.FatigueToolComponent_YZ
            FAT_TOOL1.ScaleFactor = 0.85
            LIFE = FAT_TOOL1.AddLife()
            DAMAGE = FAT_TOOL1.AddDamage()
            DAMAGE.DesignLife = 1000000
            safetyFactor = FAT_TOOL1.AddSafetyFactor()
            safetyFactor.DesignLife = 1000000
    
            printer("Add and Setup Fatigue Tool 2")
            FAT_TOOL2 = FAT_TOOL1.Duplicate()
            FAT_TOOL2.StressComponent = FatigueStressComponentType.FatigueToolComponent_XZ
    
            printer("Solve and Validate Fatigue Tool results")
            MODEL.Solve(True)
    
            FAT_Tool_1_LIFE = LIFE.Minimum.Value
            assert FAT_Tool_1_LIFE == pytest.approx(
                1628.0823, rel=0.08
            ), "Minimum Life For Fatigue Tool 1"
    
            FAT_TOOL_1_DAMAGE = DAMAGE.Maximum.Value
            assert FAT_TOOL_1_DAMAGE == pytest.approx(
                614.2195, rel=0.08
            ), "Maximum Damage For Fatigue Tool 1"
    
            FAT_TOOL_1_Safety_Factor = safetyFactor.Minimum.Value
            assert FAT_TOOL_1_Safety_Factor == pytest.approx(
                0.0122, rel=0.08
            ), "Minimum Safety Factor For Fatigue Tool 1"
    
            FAT_TOOL_2_LIFE = FAT_TOOL2.Children[0].Minimum.Value
            assert FAT_TOOL_2_LIFE == pytest.approx(
                1628.0823, rel=0.08
            ), "Minimum Life For Fatigue Tool 2"
    
            FAT_TOOL_2_DAMAGE = FAT_TOOL2.Children[1].Maximum.Value
            assert FAT_TOOL_2_DAMAGE == pytest.approx(
                614.2195, rel=0.08
            ), "Maximum Damage For Fatigue Tool 2"
    
            FAT_TOOL_2_Safety_Factor = FAT_TOOL2.Children[2].Minimum.Value
            assert FAT_TOOL_2_Safety_Factor == pytest.approx(
                0.0122, rel=0.08
            ), "Minimum Safety Factor For Fatigue Tool 2"
    
>       _innertest()

tests/embedding/test_qk_eng_wb2.py:254: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def _innertest():
        printer("Add material file")
        MODEL = Model
        MODEL.RefreshMaterials()
>       MODEL.Geometry.Children[0].Material = "eng200_material"
E       System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
E       Parameter name: index
E         at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <e85874d36dd54c51a7dcd93d72f2c404>:0 
E         at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
E         at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <e85874d36dd54c51a7dcd93d72f2c404>:0

tests/embedding/test_qk_eng_wb2.py:134: ArgumentOutOfRangeException