Changed naming convention.

This commit is contained in:
Adam Urbańczyk
2020-08-07 08:44:28 +02:00
committed by GitHub
parent 3756a243c8
commit 35dee903c7

View File

@ -33,7 +33,7 @@ def export(
fname: str,
exportType: Optional[ExportLiterals] = None,
tolerance: float = 0.1,
angularPrecision: float = 0.1,
angularTolerance: float = 0.1,
):
"""
@ -42,8 +42,8 @@ def export(
:param w: Shape or Wokrplane to be exported.
:param fname: output filename.
:param exportType: the exportFormat to use. If None will be inferred from the extension. Default: None.
:param tolerance: the tolerance, in model units. Default 0.1.
:param angularPrecision: the angular precision, in radians. Default 0.1 or about 5.7deg.
:param tolerance: the deflection tolerance, in model units. Default 0.1.
:param angularTolerance: the angular tolerance, in radians. Default 0.1.
"""
shape: Shape
@ -62,7 +62,7 @@ def export(
raise ValueError("Unknown extensions, specify export type explicitly")
if exportType == ExportTypes.TJS:
tess = shape.tessellate(tolerance, angularPrecision)
tess = shape.tessellate(tolerance, angularTolerance)
mesher = JsonMesh()
# add vertices
@ -81,7 +81,7 @@ def export(
f.write(getSVG(shape))
elif exportType == ExportTypes.AMF:
tess = shape.tessellate(tolerance, angularPrecision)
tess = shape.tessellate(tolerance, angularTolerance)
aw = AmfWriter(tess)
with open(fname, "wb") as f:
aw.writeAmf(f)
@ -96,16 +96,16 @@ def export(
shape.exportStep(fname)
elif exportType == ExportTypes.STL:
shape.exportStl(fname, tolerance, angularPrecision)
shape.exportStl(fname, tolerance, angularTolerance)
else:
raise ValueError("Unknown export type")
@deprecate()
def toString(shape, exportType, tolerance=0.1, angularPrecision=0.1):
def toString(shape, exportType, tolerance=0.1, angularTolerance=0.1):
s = StringIO.StringIO()
exportShape(shape, exportType, s, tolerance, angularPrecision)
exportShape(shape, exportType, s, tolerance, angularTolerance)
return s.getvalue()
@ -115,7 +115,7 @@ def exportShape(
exportType: ExportLiterals,
fileLike: IO,
tolerance: float = 0.1,
angularPrecision: float = 0.1,
angularTolerance: float = 0.1,
):
"""
:param shape: the shape to export. it can be a shape object, or a cadquery object. If a cadquery
@ -124,13 +124,13 @@ def exportShape(
:param fileLike: a file like object to which the content will be written.
The object should be already open and ready to write. The caller is responsible
for closing the object
:param tolerance: the tolerance, in model units
:param angularPrecision: the angular precision, in radians. Default 0.1 or about 5.7deg.
:param tolerance: the linear tolerance, in model units. Default 0.1.
:param angularTolerance: the angular tolerance, in radians. Default 0.1.
"""
def tessellate(shape, angularPrecision):
def tessellate(shape, angularTolerance):
return shape.tessellate(tolerance, angularPrecision)
return shape.tessellate(tolerance, angularTolerance)
shape: Shape
if isinstance(w, Workplane):
@ -139,7 +139,7 @@ def exportShape(
shape = w
if exportType == ExportTypes.TJS:
tess = tessellate(shape, angularPrecision)
tess = tessellate(shape, angularTolerance)
mesher = JsonMesh()
# add vertices
@ -155,7 +155,7 @@ def exportShape(
elif exportType == ExportTypes.SVG:
fileLike.write(getSVG(shape))
elif exportType == ExportTypes.AMF:
tess = tessellate(shape, angularPrecision)
tess = tessellate(shape, angularTolerance)
aw = AmfWriter(tess)
aw.writeAmf(fileLike)
else:
@ -170,7 +170,7 @@ def exportShape(
if exportType == ExportTypes.STEP:
shape.exportStep(outFileName)
elif exportType == ExportTypes.STL:
shape.exportStl(outFileName, tolerance, angularPrecision)
shape.exportStl(outFileName, tolerance, angularTolerance)
else:
raise ValueError("No idea how i got here")