-# Copyright (C) 2014-2020 CEA/DEN, EDF R&D
+# Copyright (C) 2014-2023 CEA, EDF
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#=========================================================================
# Common test function
#=========================================================================
-def testExport(theType, theFormat, theFile, theVolume, 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")
assert os.path.exists(theFile)
# Test exported file by importing
- testImport(theType, theFile, theVolume, theDelta)
+ testImport(theType, theFile, theVolume, theArea, theDelta)
def testExportXAO(theFile, theEmptyFormat = False):
type = "XAO"
# Export a shape into BREP
#=========================================================================
aRealVolume = 3.78827401738e-06
- testExport("BREP", "BREP", os.path.join(tmp_dir, "screw_export.brep"), aRealVolume, 10 ** -17)
- testExport("BRP", "BREP", os.path.join(tmp_dir, "screw_export.brp"), aRealVolume, 10 ** -17)
- testExport("BREP", "", os.path.join(tmp_dir, "screw_export.brep"), aRealVolume, 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, 10 ** -17)
- testExport("STEP", "STEP", os.path.join(tmp_dir, "screw_export.stp"), 3.788258075329978e-06, 10 ** -17)
- testExport("STEP", "", os.path.join(tmp_dir, "screw_export.step"), 3.788258075329978e-06, 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.0019293313766693052, 10 ** -17)
- testExport("IGS", "IGES-5.1", os.path.join(tmp_dir, "screw_export-5.1.igs"), 0.0019293313766693052, 10 ** -17)
- testExport("IGES", "", os.path.join(tmp_dir, "screw_export-5.1.iges"), 0.0019293313766693052, 10 ** -17)
- testExport("IGES", "IGES-5.3", os.path.join(tmp_dir, "screw_export-5.3.iges"), 3.78827401651e-06, 10 ** -17)
- testExport("IGS", "IGES-5.3", os.path.join(tmp_dir, "screw_export-5.3.igs"), 3.78827401651e-06, 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
#=========================================================================
#=========================================================================
# Check error when export to unsupported format
#=========================================================================
- testExport("BREP", "", os.path.join(tmp_dir, "screw_export.dwg"), 3.78825807533e-06, 10 ** -17, True)
+ testExport("BREP", "", os.path.join(tmp_dir, "screw_export.dwg"), 3.78825807533e-06, 0.0019293313766693052, 10 ** -17, True)
#=========================================================================
# End of test
#=========================================================================