MCPcopy Index your code
hub / github.com/CadQuery/cadquery / exportStl

Method exportStl

cadquery/occ_impl/shapes.py:484–515  ·  view source on GitHub ↗

Exports a shape to a specified STL file. :param fileName: The path and file name to write the STL output to. :param tolerance: A linear deflection setting which limits the distance between a curve and its tessellation. Setting this value too low will result in l

(
        self,
        fileName: str,
        tolerance: float = 1e-3,
        angularTolerance: float = 0.1,
        ascii: bool = False,
        relative: bool = True,
        parallel: bool = True,
    )

Source from the content-addressed store, hash-verified

482 return tr
483
484 def exportStl(
485 self,
486 fileName: str,
487 tolerance: float = 1e-3,
488 angularTolerance: float = 0.1,
489 ascii: bool = False,
490 relative: bool = True,
491 parallel: bool = True,
492 ) -> bool:
493 """
494 Exports a shape to a specified STL file.
495
496 :param fileName: The path and file name to write the STL output to.
497 :param tolerance: A linear deflection setting which limits the distance between a curve and its tessellation.
498 Setting this value too low will result in large meshes that can consume computing resources.
499 Setting the value too high can result in meshes with a level of detail that is too low.
500 Default is 1e-3, which is a good starting point for a range of cases.
501 :param angularTolerance: Angular deflection setting which limits the angle between subsequent segments in a polyline. Default is 0.1.
502 :param ascii: Export the file as ASCII (True) or binary (False) STL format. Default is binary.
503 :param relative: If True, tolerance will be scaled by the size of the edge being meshed. Default is True.
504 Setting this value to True may cause large features to become faceted, or small features dense.
505 :param parallel: If True, OCCT will use parallel processing to mesh the shape. Default is True.
506 """
507 # The constructor used here automatically calls mesh.Perform(). https://dev.opencascade.org/doc/refman/html/class_b_rep_mesh___incremental_mesh.html#a3a383b3afe164161a3aa59a492180ac6
508 BRepMesh_IncrementalMesh(
509 self.wrapped, tolerance, relative, angularTolerance, parallel
510 )
511
512 writer = StlAPI_Writer()
513 writer.ASCIIMode = ascii
514
515 return writer.Write(self.wrapped, fileName)
516
517 def exportStep(
518 self,

Callers 2

exportMethod · 0.80
exportFunction · 0.80

Calls 1

WriteMethod · 0.80

Tested by

no test coverage detected