cbiffle / catibo Goto Github PK
View Code? Open in Web Editor NEWRust implementation of the CTB/CBDDLP/PHZ 3d printing file formats.
License: BSD 2-Clause "Simplified" License
Rust implementation of the CTB/CBDDLP/PHZ 3d printing file formats.
License: BSD 2-Clause "Simplified" License
@cbiffle First things first, what a wonderful job you did here.
I'm looking at this specifically because I own a Mars 2 Pro, and it struck me as silly that the lift distance would be the same independently from the layer's surface area. The small the cross-section, the smaller the time for the vacuum to be filled by the resin for the next layer. Without going into fluid dynamics, I think there could be a huge improvement in print speed by making this parameter dynamic per layer.
Now looking at https://github.com/cbiffle/catibo/blob/master/doc/cbddlp-ctb.adoc#the-layer-table it seems like this would be impossible, am I right? There is no way to change this setting after the print has started, and it isn't override-able from the layer datum?
No issue, I just want to tell you how happy this project made me!
I bought a CR LD002R just like you, and discovered only one slicer works, and not well.
I want to do some weird stuff with this machine and need pixel-perfect control over each layer for it to work.
Hopefully I can use the exquisitely detailed documentation you've provided to get it to work.
Thank you!
Hello,
Few issues here. Trying to convert originla ctb file to decrypted one returnes only 11 layers of 100 in original. It sill can be opened in chitubox (1.6.3) but only 11 layersappear.
Also, decrypted data looks like cbddlp (based on provided document):
80 83 F8 50 FF 81 A6 50
80 83 F8 50 FF 81 A6 50
80 83 F8 50 FF 81 A6 50
On other hand, cbddlp decryption goes well and retures all 100 laters. Here's some raw data:
7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F
7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F
7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 4E FF
FF FF A9 7F 7F 7F 7F 7F 7F 7F 7F 01 FF FF FF AB
7F 7F 7F 7F 7F 7F 7F 7F FF FF FF AB 7F 7F 7F 7F
And this looks like ctb file (based on your descrription file).
I dont know if this is twist in converter or in description. Or may be I'm doing something wrong.
Actually, same procedure for phz (most interested in my case) works good. Conversion returns all layers, and raw data looks like:
80 7D 7D 7D 05
FC 7D 21
FC 7D 21
80 7D 7D 7D 05
And this is totally as described.
Thanks for your effors in reverse engineering phz format!
Additional issue on phz decoding. No AA file decodes ok, 2x AA decoded file has only 1/2 layers of original, 4xAA file has 1/4 layers of original. Results are based on my test file with 100 layers.
In the description of key generation in the document cbddlp-ctb.adoc, the following formula is given:
c = key * 0x2D83_CDAC + 0xD8A8_3424
There is an error in the value of the constant. In fact, it should be like this:
c = key * 0x2D83_CDAC + 0xD8A8_3423
I'm seeing version 3 on CTB files coming out of ChituBox 1.7.0 and Lichee Slicer 3.2.1. Do you have any insights into what could be different? It would be nice to update the documentation. Happy to help.
Hello,
I think I am using your library incorrectly, as when I try to print a CTB file generated with catibo
, it is unrecognized by the printer.
Hopefully you can spot something incorrect in my usage:
println!("Reading layer mask...");
let full_image = image::open(&args[0]).unwrap();
let (full_image_width, full_image_height) = full_image.dimensions();
println!("Encoding layer mask...");
// restructure to 1 byte per pixel (brightness)
let bpp_layer_data: Vec<u8> = full_image.clone().into_luma().pixels().map(|p| p[0]).collect();
let mut layer_data = Vec::<u8>::with_capacity(full_image_width as usize * full_image_height as usize);
encode_rle7_slice(
bpp_layer_data.iter().map(|&b| b).peekable(),
0, // no encryption dammit
0, // unused, but is layer index (IV for crypto cypher, hence unused)
&mut layer_data
);
println!("Generating preview images...");
// scale down to fit inside 512x512
println!(" Resizing to large preview image (512px * 512px)...");
let large_preview = full_image.resize(512, 512, image::imageops::FilterType::Nearest);
let (large_preview_width, large_preview_height) = large_preview.dimensions();
// scale down to fit inside 128x128 using nearest-neighbor scaling
println!(" Resizing to small preview image (128px * 128px)...");
let small_preview = full_image.resize(128, 128, image::imageops::FilterType::Nearest);
let (small_preview_width, small_preview_height) = small_preview.dimensions();
// decide on an output path and announce it
let output_path = format!("output-{}.ctb", mnemonic::to_string(rand::thread_rng().gen::<[u8; 2]>()));
println!("Building output to `./{}`", output_path);
Builder::for_revision(Magic::CTB, 2)
.encryption_key(0) // disable encryption
.large_preview(
large_preview_width,
large_preview_height,
encode_image(&large_preview.into_rgb())
)
.small_preview(
small_preview_width,
small_preview_height,
encode_image(&small_preview.into_rgb())
)
.layer_height_mm(layer_height_mm * 1E-3)
.overall_height_mm(layer_height_mm * 1E-3)
.exposure_s(exposure_time_s)
.bot_exposure_s(exposure_time_s)
.bot_layer_count(1)
.pwm_level(exposure_pwm)
.bot_pwm_level(exposure_pwm)
.print_time_s(3 + exposure_time_s as u32) // meh, 3s overhead sounds good.
.bot_lift_speed_mmpm(withdraw_speed)
.resolution([full_image_width, full_image_height])
.layer(
0.0, // layer z
exposure_time_s, // light on time
0.0, // 0s light off time after
layer_data
)
.write(
std::fs::File::create(output_path)?
)?;
Thanks!
We would like to add you to the team chat :)
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.