Skip to content

Commit

Permalink
Troubleshooting
Browse files Browse the repository at this point in the history
  • Loading branch information
openvmp committed Nov 4, 2024
1 parent e165eea commit 78cc2d4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
4 changes: 2 additions & 2 deletions partcad/src/partcad/sync_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# Leave one core for the asyncio event loop and stuff
if cpu_count > 1:
cpu_count -= 1
if cpu_count < 5:
cpu_count = 5
if cpu_count < 7:
cpu_count = 7
executor = ThreadPoolExecutor(cpu_count, "partcad-executor-")


Expand Down
42 changes: 26 additions & 16 deletions partcad/src/partcad/wrappers/wrapper_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,32 @@


def process(path, request):
reader = STEPControl_Reader()
readStatus = reader.ReadFile(path)
if readStatus != OCP.IFSelect.IFSelect_RetDone:
raise ValueError("STEP File could not be loaded")
for i in range(reader.NbRootsForTransfer()):
reader.TransferRoot(i + 1)

occ_shapes = []
for i in range(reader.NbShapes()):
occ_shapes.append(reader.Shape(i + 1))

builder = TopoDS_Builder()
compound = TopoDS_Compound()
builder.MakeCompound(compound)
for shape in occ_shapes:
builder.Add(compound, shape)
compound = None
try:
reader = STEPControl_Reader()
readStatus = reader.ReadFile(path)
if readStatus != OCP.IFSelect.IFSelect_RetDone:
raise Exception("STEP File could not be loaded")
for i in range(reader.NbRootsForTransfer()):
reader.TransferRoot(i + 1)

occ_shapes = []
for i in range(reader.NbShapes()):
occ_shapes.append(reader.Shape(i + 1))

builder = TopoDS_Builder()
compound = TopoDS_Compound()
builder.MakeCompound(compound)
for shape in occ_shapes:
builder.Add(compound, shape)
except Exception as e:
wrapper_common.handle_exception(e)
return {
"success": False,
# "exception": e,
"exception": str(e.with_traceback(None)),
"shape": None,
}

return {
"success": True,
Expand Down

0 comments on commit 78cc2d4

Please sign in to comment.