Repository navigation
Conversation
farhi
force-pushed
the
2026-10-farhi-mcdisplay-cad-more-outputs
branch
from
October 18, 2026 14:00
ec403f1 to
f3aa126
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t, add --tubes - run mcrun with --trace=2 so solid primitives (box/cylinder/cone/sphere/polyhedron) are emitted - parse the MCDISPLAY polyhedron JSON (vertices + faces) instead of failing on it - STEP: write #-references, CARTESIAN_POINT POLY_LOOPs in FACE_SURFACEs, complex SI units, REALs with decimal point, 7-field FILE_NAME (now reads cleanly in OpenCASCADE/FreeCAD) - --tubes: draw lines as cylinders with corner spheres, as in the mcdisplay-plopp 3D view Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- with -n > 0, read the traced rays and export them as one grey 'rays' part (instrument coordinates) in every output format; --tubes applies to them too - STEP: write REALs with 12 significant digits; at 6, short ray segments far from the origin collapsed into degenerate faces and OpenCASCADE dropped them - --tubes help: note that tubed rays can make files very large Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
@farhi I have
|
Contributor
|
@g5t since the original tool is your contribution, can you have a look / test? |
--trace=1 gives the legacy wireframe drawing; the help notes that STL may then be empty and that many viewers ignore lines in OBJ/PLY (use --tubes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…heck column_stack on the 2-D meshgrid arrays interleaved x/y/z across points, so every sphere (e.g. the Text.comp stroke joints) came out as spikes in all output formats. Flatten the grids first. test_mcdisplay.py: assert-based check of the tessellated primitives (radii, extents, closed surfaces, polyhedron JSON, tubes), as test_mcdisplopp.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ves) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rewrite of mcdisplay-cad: more formats, no cadquery/opencascade dependency
This is a full rewrite of the
mcdisplay-cad3D model export tool.Why ? The existing tool requires python-cadquery and opencascade, which makes its installation more complex on some systems. The wish for this PR was to bring a fully standalone implementation, with more output formats.
It now provides export in the following formats:
The old cad export supported 'step', 'stl', 'xml/x3d', 'vrml', 'gltf', 'vtkjs'. So we have added GLB, VTK, PLY, VTK and OBJ.
All formats include color cycling except STL and legacy VTK (which do not support it).
The PLY format may fail showing colors with some viewers. The GLB format is selected as default (compact format).
All exports have been tested with
castle-model-viewer(replacesview3dscene) and Blender, except STEP, which format is not supported by usual viewers (f3d, meshlab, blender, etc).The code is larger than before, but I think this is a valuable investment in terms of portability (no depends) and usability (more formats).
Declaration of use of AI-tools
Development OS / boundary conditions
Please describe what OS you developed and tested your additions on, and if any special dependencies are required:
Developped under Debian 13 trixie/arm64.
PR Checklist for contributing to McStas/McXtrace
For a coherent and useful contribution to McStas/McXtrace, please fill in relevant parts of the checklist:
My contribution contains something else