Exemple #1
0
    def test_material_card_quantities(
        self
    ):
        # test the value and unit of known quantity parameter
        # from solid build in material cards
        # keep in mind only if FreeCAD is installed all materials are copied
        # TODO Fluid materials (are they installed?)

        # get build in materials
        builtin_solid_mat_dir = join(
            FreeCAD.getResourceDir(),
            "Mod",
            "Material",
            "StandardMaterial"
        )
        fcc_print("{}".format(builtin_solid_mat_dir))
        from materialtools.cardutils import add_cards_from_a_dir as addmats
        materials, cards, icons = addmats({}, {}, {}, builtin_solid_mat_dir, "")

        # get known material quantity parameter
        from materialtools.cardutils import get_known_material_quantity_parameter as knownquant
        known_quantities = knownquant()

        # check param, value pairs
        from materialtools.cardutils import check_value_unit as checkvalueunit
        for mat in materials:
            fcc_print("{}".format(mat))
            for param, value in materials[mat].items():
                if param in known_quantities:
                    # fcc_print("    {} --> {}".format(param, value))
                    self.assertTrue(
                        checkvalueunit(param, value),
                        "Unit of quantity {} from material parameter {} is wrong."
                        .format(value, param)
                    )
    def test_material_card_quantities(
        self
    ):
        # test the value and unit of known quantity parameter
        # from solid build in material cards
        # keep in mind only if FreeCAD is installed all materials are copied
        # TODO Fluid materials (are they installed?)

        # get build in materials
        builtin_solid_mat_dir = join(
            FreeCAD.getResourceDir(),
            "Mod",
            "Material",
            "StandardMaterial"
        )
        fcc_print('{}'.format(builtin_solid_mat_dir))
        from materialtools.cardutils import add_cards_from_a_dir as addmats
        materials, cards, icons = addmats({}, {}, {}, builtin_solid_mat_dir, '')

        # get known material quantity parameter
        from materialtools.cardutils import get_known_material_quantity_parameter as knownquant
        known_quantities = knownquant()

        # check param, value pairs
        from materialtools.cardutils import check_value_unit as checkvalueunit
        for mat in materials:
            fcc_print('{}'.format(mat))
            for param, value in materials[mat].items():
                if param in known_quantities:
                    # fcc_print('    {} --> {}'.format(param, value))
                    self.assertTrue(
                        checkvalueunit(param, value),
                        'Unit of quantity {} from material parameter {} is wrong.'
                        .format(value, param)
                    )
Exemple #3
0
 def test_known_quantity_units(self):
     from materialtools.cardutils import get_known_material_quantity_parameter as knownquant
     known_quantity_parameter = knownquant()
     from materialtools.cardutils import check_parm_unit as checkparamunit
     for param in known_quantity_parameter:
         fcc_print("{}".format(param))
         self.assertTrue(
             checkparamunit(param),
             "Unit of quantity material parameter {} "
             "is not known by FreeCAD unit system.".format(param))
 def test_known_quantity_units(
     self
 ):
     from materialtools.cardutils import get_known_material_quantity_parameter as knownquant
     known_quantity_parameter = knownquant()
     from materialtools.cardutils import check_parm_unit as checkparamunit
     for param in known_quantity_parameter:
         fcc_print('{}'.format(param))
         self.assertTrue(
             checkparamunit(param),
             'Unit of quantity material parameter {} '
             'is not known by FreeCAD unit system.'
             .format(param)
         )