Converts a STEP file into a binary glTF (GLB), keeping the assembly tree as glTF nodes along with part names, colors, materials and placements.
stepData is the file as text, ArrayBuffer or Uint8Array. The mesh settings say how finely
curved surfaces are triangulated: meshPrecision is the deflection, meshAngle the angular
deflection. Z-up becomes glTF's Y-up. Failure throws.
The STEP file content and the meshing settings
The GLB file as bytes
Converts a STEP file into a binary glTF (GLB) like convertStepToGltf, with every option
exposed.
The read flags choose what to take from the file (colors, names, materials, layers, properties), the mesh settings how finely to triangulate, the export settings how the glTF is written (merged faces, 16-bit indexes, naming, scale). Switch off what you do not need.
The STEP file content and the reading, meshing and export settings
The GLB file as bytes
const options = new Bit.Inputs.OCCT.ConvertStepToGltfAdvancedDto();
options.stepData = stepText;
options.readColors = true;
options.readNames = true;
options.meshDeflection = 0.005;
options.mergeFaces = true;
options.adjustZtoY = true;
const glb = await bitbybit.occt.io.convertStepToGltfAdvanced(options);
Converts a STEP file into a binary glTF (GLB) like convertStepToGltf and compresses the
geometry with Draco, which makes the file much smaller at the cost of a Draco-capable loader.
The Draco settings set the compression level and how many bits positions, normals, texture coordinates and colors keep; fewer bits mean a smaller file and less precision.
The STEP file content, the meshing settings and the Draco settings
The GLB file as bytes
Converts a STEP file into a binary glTF (GLB) with every reading, meshing and writing option
exposed, as convertStepToGltfAdvanced does, and compresses the geometry with Draco.
The Draco settings set the compression level and how many bits positions, normals, texture coordinates and colors keep; fewer bits mean a smaller file and less precision.
The STEP file content, the reading, meshing and export settings, and the Draco settings
The GLB file as bytes
Reads the assembly structure of a STEP file without building geometry: every part and sub-assembly as a node with its id, name, whether it is an assembly, its visibility, its color and its placement matrix.
The nodes come in depth-first order, so children follow their parent. A file that cannot be parsed reports its error in the result.
The STEP file content
The list of nodes, the format version and any error
Turns the wires of a shape into DXF path records, the first step of a 2D DXF export.
The shape must lie flat on the XZ ground plane, since DXF drawings are two-dimensional. The
deflection settings say how closely curved edges are followed. Give the paths a layer with
dxfPathsWithLayer and write the file with dxfCreate.
The shape and the deflection settings
The DXF paths
Puts DXF paths on a named layer with a color, making one part of a DXF drawing.
A drawing may hold several parts, each with its own layer and color; dxfCreate writes them
into one file.
The paths, the layer name and the color
The paths as one layered part
Writes DXF parts into one DXF file and returns its text.
colorFormat chooses AutoCAD's indexed colors or true color, acadVersion the DXF version:
AC1009 is R12, the most widely readable, AC1015 is 2000. fileName and tryDownload matter
only where a browser download can be started.
The layered parts, the color format, the DXF version and the download options
The DXF file as text
Writes a shape as STEP, the standard exchange format for exact CAD geometry, and starts a browser download of the file.
With adjustYtoZ true the shape is turned so this library's Y-up becomes STEP's Z-up;
fromRightHanded skips the mirror that swap otherwise includes. fileName names the download
and tryDownload false skips it. saveShapeSTEPAndReturn gives the file's text instead.
The shape, the file name, the axis adjustment and the download options
Nothing; the download starts when the file is ready
Writes a shape as STEP, the standard exchange format for exact CAD geometry, and returns the file's text.
With adjustYtoZ true the shape is turned so this library's Y-up becomes STEP's Z-up;
fromRightHanded skips the mirror that swap otherwise includes. fileName and tryDownload
matter only where a browser download can be started.
The shape, the file name, the axis adjustment and the download options
The STEP file as text
Triangulates a shape, writes it as STL, the mesh format 3D printers read, and starts a browser download of the file.
precision is the meshing tolerance in model units; smaller values follow curved surfaces more
closely and make a bigger file. adjustYtoZ turns Y-up into Z-up. fileName names the
download, tryDownload false skips it. saveShapeStlAndReturn gives the text instead.
The shape, the file name, the meshing precision, the axis adjustment and the download options
Nothing; the download starts when the file is ready
Triangulates a shape and writes it as STL, the mesh format 3D printers and slicers read, returning the file's text.
precision is the meshing tolerance in model units; smaller values follow curved surfaces
more closely and make a bigger file. adjustYtoZ turns the shape so Y-up becomes Z-up.
fileName and tryDownload only matter where a download can start.
The shape, the file name, the meshing precision, the axis adjustment and the download options
The STL file as text
将以 File 给出的 STEP 或 IGES 文件读入一个形状。
文件的扩展名决定种类:.step、.stp 是 STEP,.iges、.igs 是 IGES。adjustZtoY 将文件的 Z 向上变为 Y 向上。无法读取的文件给出 undefined。
文件和坐标轴调整
加载的形状
将以文本给出的 STEP 或 IGES 文件读入一个形状;fileType 指定文本是两种格式中的哪一种。
adjustZtoY 将文件的 Z 向上变为 Y 向上。无法读取的文本给出 undefined。
文件文本、其格式和坐标轴调整
加载的形状
使用 OCCT 读写 CAD 文件:内核上
io提供的所有功能,外加接受 STEP 或 IGES 文件(File 对象或其文本)并返回形状的加载器。按惯例文件为 Z 轴向上,因此除非adjustZtoY设为 false,否则加载的形状会被转为本库的 Y 轴向上。