mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-13 10:10:34 +05:00
Mantis issue 0021511: STEP units. Rename parameter of ImportSTEP. Provide correct reading of files without units.
This commit is contained in:
parent
871970274e
commit
b55a2a917b
@ -7358,73 +7358,113 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
RaiseIfFailed("Import", self.InsertOp)
|
RaiseIfFailed("Import", self.InsertOp)
|
||||||
return anObj
|
return anObj
|
||||||
|
|
||||||
## Shortcut to ImportFile() for BREP format
|
## Shortcut to ImportFile() for BREP format.
|
||||||
|
# Import a shape from the BREP file with given name.
|
||||||
|
# @param theFileName The file, containing the shape.
|
||||||
|
# @return New GEOM.GEOM_Object, containing the imported shape.
|
||||||
#
|
#
|
||||||
# @ref swig_Import_Export "Example"
|
# @ref swig_Import_Export "Example"
|
||||||
def ImportBREP(self, theFileName):
|
def ImportBREP(self, theFileName):
|
||||||
"""
|
"""
|
||||||
geompy.ImportFile(...) function for BREP format
|
geompy.ImportFile(...) function for BREP format
|
||||||
|
Import a shape from the BREP file with given name.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
theFileName The file, containing the shape.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
New GEOM.GEOM_Object, containing the imported shape.
|
||||||
"""
|
"""
|
||||||
# Example: see GEOM_TestOthers.py
|
# Example: see GEOM_TestOthers.py
|
||||||
return self.ImportFile(theFileName, "BREP")
|
return self.ImportFile(theFileName, "BREP")
|
||||||
|
|
||||||
## Shortcut to ImportFile() for IGES format
|
## Shortcut to ImportFile() for IGES format
|
||||||
# @param doScale If True, file length units will be ignored (set to 'meter')
|
# Import a shape from the IGES file with given name.
|
||||||
# and result model will be scaled.
|
# @param theFileName The file, containing the shape.
|
||||||
|
# @param ignoreUnits If True, file length units will be ignored (set to 'meter')
|
||||||
|
# and result model will be scaled, if its units are not meters.
|
||||||
# If False (default), file length units will be taken into account.
|
# If False (default), file length units will be taken into account.
|
||||||
|
# @return New GEOM.GEOM_Object, containing the imported shape.
|
||||||
#
|
#
|
||||||
# @ref swig_Import_Export "Example"
|
# @ref swig_Import_Export "Example"
|
||||||
def ImportIGES(self, theFileName, doScale = False):
|
def ImportIGES(self, theFileName, ignoreUnits = False):
|
||||||
"""
|
"""
|
||||||
geompy.ImportFile(...) function for IGES format
|
geompy.ImportFile(...) function for IGES format
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
doScale If True, file length units will be ignored (set to 'meter')
|
theFileName The file, containing the shape.
|
||||||
and result model will be scaled.
|
ignoreUnits If True, file length units will be ignored (set to 'meter')
|
||||||
|
and result model will be scaled, if its units are not meters.
|
||||||
If False (default), file length units will be taken into account.
|
If False (default), file length units will be taken into account.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
New GEOM.GEOM_Object, containing the imported shape.
|
||||||
"""
|
"""
|
||||||
# Example: see GEOM_TestOthers.py
|
# Example: see GEOM_TestOthers.py
|
||||||
if doScale:
|
if ignoreUnits:
|
||||||
return self.ImportFile(theFileName, "IGES_SCALE")
|
return self.ImportFile(theFileName, "IGES_SCALE")
|
||||||
return self.ImportFile(theFileName, "IGES")
|
return self.ImportFile(theFileName, "IGES")
|
||||||
|
|
||||||
## Return length unit from given IGES file
|
## Return length unit from given IGES file
|
||||||
# @param doScale If True, file length units will be ignored (set to 'meter')
|
# @param theFileName The file, containing the shape.
|
||||||
# and result model will be scaled.
|
# @return String, containing the units name.
|
||||||
# If False (default), file length units will be taken into account.
|
|
||||||
#
|
#
|
||||||
# @ref swig_Import_Export "Example"
|
# @ref swig_Import_Export "Example"
|
||||||
def GetIGESUnit(self, theFileName, doScale = False):
|
def GetIGESUnit(self, theFileName):
|
||||||
"""
|
"""
|
||||||
Return length units from given IGES file
|
Return length units from given IGES file
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
theFileName The file, containing the shape.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
String, containing the units name.
|
||||||
"""
|
"""
|
||||||
# Example: see GEOM_TestOthers.py
|
# Example: see GEOM_TestOthers.py
|
||||||
aUnitName = self.InsertOp.ReadValue(theFileName, "IGES", "LEN_UNITS")
|
aUnitName = self.InsertOp.ReadValue(theFileName, "IGES", "LEN_UNITS")
|
||||||
return aUnitName
|
return aUnitName
|
||||||
|
|
||||||
## Shortcut to ImportFile() for STEP format
|
## Shortcut to ImportFile() for STEP format
|
||||||
|
# Import a shape from the STEP file with given name.
|
||||||
|
# @param theFileName The file, containing the shape.
|
||||||
|
# @param ignoreUnits If True, file length units will be ignored (set to 'meter')
|
||||||
|
# and result model will be scaled, if its units are not meters.
|
||||||
|
# If False (default), file length units will be taken into account.
|
||||||
|
# @return New GEOM.GEOM_Object, containing the imported shape.
|
||||||
#
|
#
|
||||||
# @ref swig_Import_Export "Example"
|
# @ref swig_Import_Export "Example"
|
||||||
def ImportSTEP(self, theFileName, doScale = False):
|
def ImportSTEP(self, theFileName, ignoreUnits = False):
|
||||||
"""
|
"""
|
||||||
geompy.ImportFile(...) function for STEP format
|
geompy.ImportFile(...) function for STEP format
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
doScale If True, file length units will be ignored (set to 'meter')
|
theFileName The file, containing the shape.
|
||||||
and result model will be scaled.
|
ignoreUnits If True, file length units will be ignored (set to 'meter')
|
||||||
|
and result model will be scaled, if its units are not meters.
|
||||||
If False (default), file length units will be taken into account.
|
If False (default), file length units will be taken into account.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
New GEOM.GEOM_Object, containing the imported shape.
|
||||||
"""
|
"""
|
||||||
# Example: see GEOM_TestOthers.py
|
# Example: see GEOM_TestOthers.py
|
||||||
if doScale:
|
if ignoreUnits:
|
||||||
return self.ImportFile(theFileName, "STEP_SCALE")
|
return self.ImportFile(theFileName, "STEP_SCALE")
|
||||||
return self.ImportFile(theFileName, "STEP")
|
return self.ImportFile(theFileName, "STEP")
|
||||||
|
|
||||||
## Return length unit from given IGES or STEP file
|
## Return length unit from given IGES or STEP file
|
||||||
|
# @param theFileName The file, containing the shape.
|
||||||
|
# @return String, containing the units name.
|
||||||
#
|
#
|
||||||
# @ref swig_Import_Export "Example"
|
# @ref swig_Import_Export "Example"
|
||||||
def GetSTEPUnit(self, theFileName):
|
def GetSTEPUnit(self, theFileName):
|
||||||
"""
|
"""
|
||||||
Return length units from given STEP file
|
Return length units from given STEP file
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
theFileName The file, containing the shape.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
String, containing the units name.
|
||||||
"""
|
"""
|
||||||
# Example: see GEOM_TestOthers.py
|
# Example: see GEOM_TestOthers.py
|
||||||
aUnitName = self.InsertOp.ReadValue(theFileName, "STEP", "LEN_UNITS")
|
aUnitName = self.InsertOp.ReadValue(theFileName, "STEP", "LEN_UNITS")
|
||||||
|
@ -131,7 +131,7 @@ extern "C"
|
|||||||
aValue = new TCollection_HAsciiString ("M");
|
aValue = new TCollection_HAsciiString ("M");
|
||||||
else if (aLenUnits == "INCH")
|
else if (aLenUnits == "INCH")
|
||||||
aValue = new TCollection_HAsciiString ("INCH");
|
aValue = new TCollection_HAsciiString ("INCH");
|
||||||
// TODO
|
// TODO (for other units than mm, cm, m or inch)
|
||||||
//else if (aLenUnits == "")
|
//else if (aLenUnits == "")
|
||||||
// aValue = new TCollection_HAsciiString ("");
|
// aValue = new TCollection_HAsciiString ("");
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ extern "C"
|
|||||||
Interface_Static::SetCVal("xstep.cascade.unit", "MM");
|
Interface_Static::SetCVal("xstep.cascade.unit", "MM");
|
||||||
else if (aLenUnits == "centimetre")
|
else if (aLenUnits == "centimetre")
|
||||||
Interface_Static::SetCVal("xstep.cascade.unit", "CM");
|
Interface_Static::SetCVal("xstep.cascade.unit", "CM");
|
||||||
else if (aLenUnits == "metre")
|
else if (aLenUnits == "metre" || aLenUnits.IsEmpty())
|
||||||
Interface_Static::SetCVal("xstep.cascade.unit", "M");
|
Interface_Static::SetCVal("xstep.cascade.unit", "M");
|
||||||
else if (aLenUnits == "INCH")
|
else if (aLenUnits == "INCH")
|
||||||
Interface_Static::SetCVal("xstep.cascade.unit", "INCH");
|
Interface_Static::SetCVal("xstep.cascade.unit", "INCH");
|
||||||
@ -205,7 +205,7 @@ extern "C"
|
|||||||
theError = "The file contains not supported units.";
|
theError = "The file contains not supported units.";
|
||||||
return aResShape;
|
return aResShape;
|
||||||
}
|
}
|
||||||
// TODO
|
// TODO (for other units than mm, cm, m or inch)
|
||||||
//else if (aLenUnits == "")
|
//else if (aLenUnits == "")
|
||||||
// Interface_Static::SetCVal("xstep.cascade.unit", "");
|
// Interface_Static::SetCVal("xstep.cascade.unit", "");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user