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.

bug in stl export

See original GitHub issue

I’m trying to handle stl export in cq-server.

So far I tried this:

from jupyter_cadquery.ocp_utils import write_stl_file
# ...
assembly = to_assembly(*self.models, names=self.names)
write_stl_file(assembly.compound(), 'output.stl')

It fails with this error:

  File "/home/somed/.cache/pypoetry/virtualenvs/cadquery-server-Io9SCdfb-py3.10/lib/python3.10/site-packages/jupyter_cadquery/ocp_utils.py", line 248, in write_stl_file
    mesh = BRepMesh_IncrementalMesh(compound, tolerance, True, angular_tolerance)
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. OCP.BRepMesh.BRepMesh_IncrementalMesh()
    2. OCP.BRepMesh.BRepMesh_IncrementalMesh(theShape: OCP.TopoDS.TopoDS_Shape, theLinDeflection: float, isRelative: bool = False, theAngDeflection: float = 0.5, isInParallel: bool = False)
    3. OCP.BRepMesh.BRepMesh_IncrementalMesh(theShape: OCP.TopoDS.TopoDS_Shape, theParameters: IMeshTools_Parameters, theRange: OCP.Message.Message_ProgressRange = <OCP.Message.Message_ProgressRange object at 0x7fbe17cac8b0>)

Invoked with: <OCP.TopoDS.TopoDS_Compound object at 0x7fbe0662a7b0>, None, True, None

In the write_stl_file function, there is a call to BRepMesh_IncrementalMesh:

mesh = BRepMesh_IncrementalMesh(compound, tolerance, True, angular_tolerance)

Where tolerance is defaulted to False, but it’s supposed to be a required float.

Maybe you have to set the default tolerance to a float in the function signature?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
bernhard-42commented, Sep 18, 2022

@roipoussiere V3.3.0 is out. It fixes this issue by using 0.01 and 0.2 as defaults in exportSTL (module exports) exportSTL wraps write_stl_file to create a compound before. This is the routine that should be used, write_stl_file is an internal function and shouldn’t be used.

1reaction
bernhard-42commented, Sep 17, 2022

@roipoussiere just published 1.7.0 of three-cad-viewer The reason why I increased the minor version is that it changes the default orientation behavior:

  • up=“Z” now uses the isometric orientation and button behaviour of FreecAD and Onshape, …
  • up=“Y” works how Fusion 360 works when up is set to Y
  • up=“L” (legacy) works as Jupyter CadQuery before.

Will now start to publish the dependent package and jupyter cadquery I think that addresses the comment in discord about wrong orientation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug in stl export? - FreeCAD Forum
I'm trying to 3d print a model rocket. I designed the nosecone by revolving an arc. It looks good in the part design...
Read more >
stl export for 3d printing bug - Maya - Autodesk Forums
Hello, having an odd problem here that i can't diagnose with a couple stl exports i made for 3d printing, the model was...
Read more >
My STL doesn't download or it hangs forever. What's wrong?
1. Make sure you are on the Chrome browser (The native Windows Store app has a known export bug). · 2. Try selecting...
Read more >
STLExport Bug(ish) - Babylon.js Forum
I'm using the STLExport functionality, but when I import the STL file into my slicer, it says that I have thousands of open...
Read more >
[Bug] Stl export only 1Mb - 3D-Coat
I have made a model in Surface mode and when i export it to 3d printer the stl file is only 1Mb, that...
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