Skip to content

Instantly share code, notes, and snippets.

@TobleMiner
Created November 19, 2023 18:02
Show Gist options
  • Save TobleMiner/029f78e318ec82d7a5bfbb2cb6fac0e5 to your computer and use it in GitHub Desktop.
Save TobleMiner/029f78e318ec82d7a5bfbb2cb6fac0e5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import sys
from OCC.Core.STEPControl import STEPControl_Reader
from OCC.Core.IFSelect import IFSelect_RetDone, IFSelect_ItemsByEntity
from OCC.Core import Tesselator
input_file = sys.argv[1]
output_file = sys.argv[2]
step_reader = STEPControl_Reader()
status = step_reader.ReadFile(input_file)
print(status)
if status == IFSelect_RetDone:
failsonly = False
step_reader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity)
step_reader.PrintCheckTransfer(failsonly, IFSelect_ItemsByEntity)
print(step_reader.NbShapes())
aResShape = step_reader.Shape(1)
else:
print("Error: can't read file.")
sys.exit(0)
Tesselator(aResShape).ExportShapeToX3D(output_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment