How to convert the format .step and .stp in gltf?

good afternoon, I have been trying to implement this format for four months .step and. stp via threejs, since this is already the standard for working with these models and customers are asking for everything.
What I found on this topic, you just need to use either nodjs or pythonocc, but how to implement it is not said, how can it be implemented ?

a step loader would be complex to implement, the triangulation is probably too expensive for javascript. at work we’re building https://buerli.io which is an embed cad system, it supports step/iges and it’s directly wired into threejs.

it’s in the last stages and we finally have a wasm module working in the browser. if you need it quick you can write them a mail and request access, we’ve already sent it to a couple of people that are testing it currently.

here’s a small example app built around the embed cad. it’s loading a step assembly, displays it, and shows the tree structures. the actual code that loads and displays it is around 1-3 lines of code: init(), load(…), scene.add(model)

1 Like

How do I understand it can be implemented in threejs ?

will it work together with threejs?

from an older thread (STEP loader antlr v4 based · Issue #7125 · mrdoob/three.js · GitHub):

STEP is complex, and in most cases will need to be processed by a CAD kernel to get to a format that three.js can currently load. The reason is that STEP contains several representations for geometric shapes, the most common being Advanced BREP (often with NURBS and trimming). There is an open source project that generates a low-level API for STEP data (www.stepcode.org) that is used by BRL-CAD and OpenVSP. OpenCasCade has its own STEP translation capability, which is used by FreeCAD (and others) for STEP and IfcOpenShell for IFC. Clara.io can import both STEP and IFC, but like many other free tools (including open source such as FreeCAD and OpenCasCADE) lacks modern STEP capabilities like associative 3D text, supplemental geometry, model styling and organization, tessellation, user defined attributes, PMI, etc. (www.cax-if.org). The NIST STEP File Analyzer can convert most modern STEP capabilities to VRML/X3D, and is free but not open source. So unless three.js develops capabilities to cover more of the STEP geometric representations, STEP and IFC data will need to be processed by something into a form that three.js can load (like three.js json, STL, VRML/X3D, COLLADA, etc.)

not sure if that is still accurate

will it work together with threejs?

yes. but again, it’s not released. you’d have to request access.

As I understand it, I need to write, I would like to get access to your product since I want to implement the step and stp formats on my project, right ?

This project is somehow implemented I could not understand although it is a project https://studia3d.com/upload uses threejs.
And this project could not understand how they implemented Craftcloud

If you’re using ifc models (which are basically step files) Take a look at this: GitHub - tomvandig/web-ifc: IFC parsing and geometry generation in WASM!

1 Like

Could you say more about how those are related? I think part of the reason we get questions about STEP files is that it’s hard to convert them to other formats, is converting to IFC somehow easier?

1 Like

Hi Don,

IFC standard file (IFC-SPF) follows the definition of the STEP-file defined in ISO 10303-21. From what I understand is that the two formats should therefore be interchangeable. If not, most CAD-type software that can export STEP files should also be able to export IFC formats.

Since the original question is: How to convert .step / .stp to GLTF, I just pointed to an IFC loader that I know works (it’s still a work in progress, but most of the features are there) that works with Three. So what about you load your model with the ifc-loader, then export the scene with the GLTF exporter? I think that answers OP’s question, right? Or at least give some direction of where to look for something that could be possible.

At the very least it should give a starting point of building a STEP loader if someone wants to give that a shot :grinning_face_with_smiling_eyes:

2 Likes

Ah that’s helpful to know, thanks!

Thank you very much really should help, at least one sensible advice, and then I didn’t know where to look for information anymore thank you very much :slight_smile:

If I understand you correctly, we can convert formats .STEP / .STP in .IFC, and then convert it to the .gltf format.
Do I understand you correctly ?

You can do one of two things - an easy method and a hard method.

The easiest thing to do is export your models to IFC format (instead of .step) and use the ifc-loader that is being worked on right now.

The other option is to use the IFC-loader as inspiration / starting point to write your own STEP-loader. Since implementing a performant STEP-parser in javascript is incredibly difficult, the IFC-loader should be a good starting point since the data formats are very similar.

The - by far - easiest thing to do is just export your models to GLTF (or a similar format) from the CAD application directly ofcourse, but I think thats besides the point of this topic.

1 Like

Thank you very much for your help.