question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Part.OCCError: Bnd_Box is void

See original GitHub issue

I am using a simple script to convert .step to .gltf

import sys
from cqparts import Part
args = sys.argv[1:]
filename = args[0].split(".")[0]
Part.importer('step')(args[0]).exporter('gltf')(filename + '.gltf')

And I get:

File “/home/home/.local/share/virtualenvs/blueprint-z4-87zsQ/lib/python2.7/site- packages/cadquery/freecad_impl/shapes.py”, line 966, in clean r = self.wrapped.removeSplitter()

It happens just with certain files (but they are not corrupt or anything). Any ideas what can be done to avoid this error? Also, it takes 5+ min befoer I get the error (4mb file).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jan0991commented, Jan 24, 2019

@fragmuffin thanks for the help, I really appreciate it!

1reaction
fragmuffincommented, Jan 24, 2019

Hi @jan0991, sorry for the delay, I’ve been busy and got distracted.

I think I see the problem, the step file you’re importing has multiple parts, so it’s not a Part, but an Assembly. When calling Part.importer('step') you get back an object that will create a Part class, and return an instance of that class to import the step file you give it (there’s a few steps there)… but you want in importer to return an Assembly instance instead.

So the solution is as simple as exchanging Part for Assembly:

>>> from cqparts import Assembly
>>> from cqparts.display import display
>>> filename = 'CX - 37 BL.STEP'
>>> obj = Assembly.importer('step')(filename)
>>> isinstance(obj, Assembly)
True

display from a console should open a web-browser to display a gltf export

>>> display(obj)

image

In addition, because the Assembly has nested components, each one can be displayed individually

>>> display(obj.components['185'])

image

Sadly this list of components is just a sequential index, each component’s name, hierarchy, and colour is lost during this import. An improvement is on the horizon #72, but it’s probably a distant horizon because its priority is a bit low.

The above code is working on the current master with no changes, so I’ll close this issue with the assumption it’ll work on yours too.

Please let me know how you go, and feel free to re-open if I’m wrong 😉 Thank you for the feedback @jan0991 , it’s always good to see what people are doing with cqparts and cadquery.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bnd_box is void error - FreeCAD Forum
Hello, I am trying to export a file into a STP format and I am getting bnd_box is void error. Since I am...
Read more >
"Bnd_Box is void" exception when running ShapeAnalysis
I was trying to get the uv-min and max parameters from a face using ShapeAnalysis::GetFaceUVBounds(), and in one case I encountered a ......
Read more >
Error creating thread in nut · Issue #42 - GitHub
<class 'Part.OCCError'>: Shape is not a shell. Error creating thread in M5 nut (EN-1661):. Traceback (most recent call last):
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found