Например, в pythonOCC есть функции read_gltf_file и write_step_file. .
Я использую pygltflib для чтения GLB и сохранения как GLTF (просто json-версия GLB). Однако мне pythonOCC не удается прочитать и преобразовать это в STEP.
Код: Выделить всё
GLB --(pygltflib)--> GLTF --(pythonOCC)--> STEP
Вот что я делаю:
Код: Выделить всё
from OCC.Extend.DataExchange import read_gltf_file, write_step_file
from pygltflib import GLTF2
geom = GLTF2().load(glb_src_file)
geom.save_json(gltf_file) # I can open this file in Windows 3D Viewer
gltf=read_gltf_file(glt_file, verbose=True) # [] empty list for some reason
if gltf:
write_step_file(gltf) # only if the last step works.
Код: Выделить всё
def glb2step(path):
# what to do here?
# writes step file to disk
Подробнее здесь: https://stackoverflow.com/questions/786 ... -in-python