xslasd / step2glb

step2glb Introduction Convert 3d model (STL/IGES/STEP/OBJ/FBX) to gltf and other Theoretical supported file formats Import: obj, 3ds, stl, ply, gltf, glb, off, 3dm, fbx, dae, wrl, 3mf, ifc, brep, step, iges, fcstd, bim. Export: obj, stl, ply, gltf, glb, off, 3dm, bim.
Apache License 2.0
22 stars 4 forks source link

step2glb

license release

step2glb Introduction

Convert 3d model (STL/IGES/STEP/OBJ/FBX) to gltf and other

Theoretical supported file formats

Start STEP file to GLB file service

Project setup

npm install

Configure config.json file

{
  "callback_url": "", // Conversion file result callback interface
  "callback_file": true, // When calling the conversion file result callback interface, synchronously upload the converted file stream.
  "s3_upload_config": {
    "endPoint": "127.0.0.1",
    "port": 9010,
    "useSSL": false,
    "accessKey": "xxxx",
    "secretKey": "xxxxx",
    "bucketName": "xxx-asset"
  }
}

Run Service

npm run dev

or

node ./app.js

STEP file to GLB file service usage steps

1、Interface for submitting STEP files

request /convertwork/v1/importfile

method:POST

data type:json

{
  "request_id": "", //Request ID, used for conversion result identification, required.
  "url": "", //Choose between the network file address, URL or file Only one.
  "file": "<file>", //The file stream to convert,URL or file Only one.
  "convert_type": "glb", //Conversion file type glb, etc., required.
  "file_name": "", //file name,The file name must have a suffix.(for example:test.step)
  "save_path": "" //minio s3 Save File Path
}

response

{
  "code": 0,
  "msg": "OK",
  "data": "gid" //Used for transitioning status queries
}

ecode

4000 Request parameter error. Verify mandatory parameters
4001 Unsupported file type
4002 Unsupported conversion file type

2、Conversion file progress query interface

ps: When the conversion file is incorrect or completed, the progress information is automatically eliminated.

request /convertwork/v1/progress

method:GET

data type:json

{
  "gid": "" //Unique identification of the conversion file.
}

response

{
  "code": 0,
  "msg": "OK",
  "data": {
    "stage": "", //transition stage
    //FileListProgress Zip file processing, msg contains current, total
    //FileLoadProgress File stream loading, msg contains current, total
    //ImportStart
    //ExportStart
    "msg": "current, total" //Stage messages
  }
}

ecode

4003 Conversion file progress information does not exist

3、Conversion file result callback interface (3D file conversion completion callback interface)

request

method:POST

data type:json

{
  "request_id": "", //Unique identification of the conversion file.
  "status": 0, //0 successfully converted; 1 Conversion failed
  "msg": "", //Error message when conversion fails
  "file": "<file>", //The converted file stream, when config.callback_ File=true
  "file_path": "" //Converted mini s3 file path
}

If the response fails, it will automatically retry 3 times.

{
  "code": 0,
  "msg": "OK"
}

Third-party Library

The engine code in this library uses the https://3dviewer.net/ library.