Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong face orientation when exporting assemblies to VRML #1158

Closed
mojca opened this issue Sep 22, 2022 · 10 comments
Closed

Wrong face orientation when exporting assemblies to VRML #1158

mojca opened this issue Sep 22, 2022 · 10 comments

Comments

@mojca
Copy link

mojca commented Sep 22, 2022

I'm not yet "proficient in interpreting VRML files", but it seems that the assemblies exported into VRML end up with wrong face orientation.

I first reported the issue to KiCad:

and prepared the files with a minimum example here:

import cadquery as cq

box = cq.Workplane().box(2.0, 4.0, 1.0)
assy = cq.Assembly(box, loc=cq.Location((0,0,0)), color=cq.Color("black"))

cq.exporters.export(box, 'box-ok.wrl', cq.exporters.ExportTypes.VRML)
assy.save('box-has-back-face-culling-issues.wrl', exportType='VRML')

@jmwright

@adam-urbanczyk
Copy link
Member

Currently VRML export is based on VTK and it uses VTK-based normal calculation. In 7.6 it is possible to use the normals from OCCT. This line would have to be modified.

tolerance, angularTolerance

So long story short - let's wait till 7.6 is merged and try to fix it there.

@mojca
Copy link
Author

mojca commented Sep 26, 2022

If I understand correctly: someone needs to finalize support for Open CASCADE version 7.6.0 in CadQuery and then you'll be able to test an alternative approach to export to VRML and see if it works better? (It's not totally unambiguous what version 7.6 refers to.) Thank you for checking this out.

@adam-urbanczyk
Copy link
Member

Indeed, [OCCT/OCP] 7.6. See: #1156

@adam-urbanczyk
Copy link
Member

@mojca could you check if #1167 solves this issue?

@mojca
Copy link
Author

mojca commented Oct 4, 2022

What is the best way to install CadQuery in a proper way, so that I will be able to test that change? (I would prefer to stick with pip rather than conda, if possible. Or I can manually edit some files if needed.)

Something like this?
https://stackoverflow.com/a/20101940

@adam-urbanczyk
Copy link
Member

This or clone the repo and use pip install -e .. You might want to ignore the deps if you already installed them.

@mojca
Copy link
Author

mojca commented Oct 5, 2022

Thank you, that seems to work fine (both the installation and rendering a complex model).

@mojca
Copy link
Author

mojca commented Oct 5, 2022

This leaves two remaining "issues" related to KiCad:

  • it would be handy to have an additional export parameter for scale or base unit assy.save('model.wrl', exportType='VRML', scale=1/2.54)
  • KiCad developers complain about the VRML output format being heavily unoptimized, see https://gitlab.com/kicad/code/kicad/-/issues/12400

But those are pretty unrelated and I'll probably open a new issue for those.

@adam-urbanczyk
Copy link
Member

Ok, open new issues @mojca, but please use more quantitative language than "something is heavily unoptimized".

@adam-urbanczyk
Copy link
Member

Solved by #1167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants