STLExporter.html 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>STLExporter - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">STLExporter</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>An exporter for STL.</p>
  16. <p>STL files describe only the surface geometry of a three-dimensional object without
  17. any representation of color, texture or other common model attributes. The STL format
  18. specifies both ASCII and binary representations, with binary being more compact.
  19. STL files contain no scale information or indexes, and the units are arbitrary.</p></div>
  20. <h2>Code Example</h2>
  21. <div translate="no"><pre><code class="language-js">const exporter = new STLExporter();
  22. const data = exporter.parse( mesh, { binary: true } );
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <h2 class="subsection-title">Import</h2>
  27. <p><span translate="no">STLExporter</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  28. <pre><code class="language-js">import { STLExporter } from 'three/addons/exporters/STLExporter.js';</code></pre>
  29. <div class="container-overview">
  30. <h2>Constructor</h2>
  31. <h3 class="name name-method" id="STLExporter" translate="no">new <a href="#STLExporter">STLExporter</a><span class="signature">()</span> </h3>
  32. <div class="method">
  33. </div>
  34. </div>
  35. <h2 class="subsection-title">Methods</h2>
  36. <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( scene : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, options : <span class="param-type"><a href="STLExporter.html#~Options">STLExporter~Options</a></span> )</span><span class="type-signature"> : string | ArrayBuffer</span> </h3>
  37. <div class="method">
  38. <div class="description">
  39. <p>Parses the given 3D object and generates the STL output.</p>
  40. <p>If the 3D object is composed of multiple children and geometry, they are merged into a single mesh in the file.</p>
  41. </div>
  42. <table class="params">
  43. <tbody>
  44. <tr>
  45. <td class="name">
  46. <strong>scene</strong>
  47. </td>
  48. <td class="description last">
  49. <p>A scene, mesh or any other 3D object containing meshes to encode.</p>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td class="name">
  54. <strong>options</strong>
  55. </td>
  56. <td class="description last">
  57. <p>The export options.</p>
  58. </td>
  59. </tr>
  60. </tbody>
  61. </table>
  62. <dl class="details">
  63. <dt class="tag-returns"><strong>Returns:</strong> The exported STL.</dt>
  64. </dl>
  65. </div>
  66. <h2 class="subsection-title">Type Definitions</h2>
  67. <div class="member">
  68. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  69. <div class="description">
  70. <p>Export options of <code>STLExporter</code>.</p>
  71. </div>
  72. <table class="props">
  73. <tbody>
  74. <tr>
  75. <td class="name">
  76. <strong>binary</strong>
  77. <br>
  78. <span class="param-type">boolean</span>
  79. </td>
  80. <td class="description last">
  81. <p>Whether to export in binary format or ASCII.</p>
  82. <p>Default is <code>false</code>.</p>
  83. </td>
  84. </tr>
  85. </tbody>
  86. </table>
  87. </div>
  88. <h2 class="subsection-title">Source</h2>
  89. <p>
  90. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/STLExporter.js" translate="no" target="_blank" rel="noopener">examples/jsm/exporters/STLExporter.js</a>
  91. </p>
  92. </article>
  93. </section>
  94. <script src="../scripts/linenumber.js"></script>
  95. <script src="../scripts/page.js"></script>
  96. </body>
  97. </html>
粤ICP备19079148号