djeedai / weldr Goto Github PK
View Code? Open in Web Editor NEWA Rust library and command-line tool to manage LDraw files (.ldr)
Home Page: https://crates.io/crates/weldr
License: Apache License 2.0
A Rust library and command-line tool to manage LDraw files (.ldr)
Home Page: https://crates.io/crates/weldr
License: Apache License 2.0
Ldraw has an MPD extension for embedding multiple files in the same file. The extension is documented here: https://www.ldraw.org/article/47.html.
While files using the MPD extension typically use the .mpd extension, it's also common to see .ldr files containing multiple embedded files. This seems to be the standard way to define submodels in a single ldraw file or embed custom parts.
The current parsing implementation assumes all subfile commands come from the resolver like DiskResolver
, which won't be the case for embedded files. This causes resolve errors. The spec doesn't make any requirements on how to handle embedded filenames "masking" the filenames of actual parts on disk. This could theoretically be handled by just parsing and adding all the embedded files to the source map before recursing into the subfiles themselves. This would ensure the embedded submodel
file gets loaded before we try and resolve the command 1 ... submodel
.
This may also require changes to the return type of the parse commands. Returning a single SourceFile
may not adequately capture that the file could have embedded files. This depends on whether a SourceFile
should represent the list of commands in a single ldraw file or the file "blocks" as represented in the MPD extension. It still makes sense for parse_raw
to return the SourceFile
. The recursive version parse
could return all commands in a single SourceFile
, return a collection of SourceFile
, or not return a SourceFile
at all.
I'm currently working on reworking the file loading to try and support this extension as described above. Let me know if you have any suggestions or concerns.
It would be safer to let bytemuck
handle those conversions, the maintainers have put a lot of thinking into making sure their implementation is safe.
See what Rust version bytemuck
supports; they say 1.34 for base without feature, but do we need any feature?
cgmath
is kind of old and unmaintained, and missing a lot of utility methods. This makes the code pretty verbose/ugly.
Logging to remember:
CHANGELOG also missing reference to fix of #21
I was looking for robust and efficient ldraw parsers in Rust and found this crate. From my initial experience, the library has been very well documented and easy to use. I noticed in #2 that the code likely hasn't been run against the entire parts library yet. I've already found some panics.
I'm getting the error Utf8Error { valid_up_to: 10, error_len: Some(1) }
at this section of code. Rust doesn't seem to complain about the formatting when I trying and convert the file to utf8 with std::fs::read_to_string
. This happens on the recently downloaded ldraw as well as bricklink studio parts libraries. I can upload the dat file if needed.
Lines 414 to 420 in aae1bff
iter()
), transparently descending into sub-fileslocal_iter()
) including sub-file commands, without dereferencingexamples/
only)6143.dat
) (94fd91f)convert gltf
: Output glTF buffer inline inside JSON to allow stdout
outputSee the discussion at https://forums.ldraw.org/thread-13787-post-13790.html
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.