diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fe8a80b9..7347654a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,6 +9,8 @@ updates: directory: "/" # Location of package manifests schedule: interval: "daily" + ignore: + - dependency-name: "webrtc" reviewers: - jessfraz - adamchalmers diff --git a/Cargo.lock b/Cargo.lock index 1c8e4a8c..645b117b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -152,9 +152,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "approx" @@ -182,7 +182,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -191,14 +191,29 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "asn1-rs" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" +dependencies = [ + "asn1-rs-derive 0.4.0", + "asn1-rs-impl 0.1.0", + "displaydoc", + "nom", + "num-traits 0.2.19", + "rusticata-macros", + "thiserror 1.0.68", +] + [[package]] name = "asn1-rs" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22ad1373757efa0f70ec53939aabc7152e1591cb485208052993070ac8d2429d" dependencies = [ - "asn1-rs-derive", - "asn1-rs-impl", + "asn1-rs-derive 0.5.0", + "asn1-rs-impl 0.2.0", "displaydoc", "nom", "num-traits 0.2.19", @@ -207,6 +222,18 @@ dependencies = [ "time", ] +[[package]] +name = "asn1-rs-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure 0.12.6", +] + [[package]] name = "asn1-rs-derive" version = "0.5.0" @@ -215,8 +242,19 @@ checksum = "7378575ff571966e99a744addeff0bff98b8ada0dedf1956d59e634db95eaac1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", - "synstructure", + "syn 2.0.96", + "synstructure 0.13.1", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -227,7 +265,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -238,7 +276,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -303,6 +341,12 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" @@ -595,9 +639,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.23" +version = "4.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" +checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783" dependencies = [ "clap_builder", "clap_derive", @@ -605,9 +649,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.23" +version = "4.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" +checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121" dependencies = [ "anstream", "anstyle", @@ -617,14 +661,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -881,14 +925,14 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] name = "cxx" -version = "1.0.133" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e1ec88093d2abd9cf1b09ffd979136b8e922bf31cad966a8fe0d73233112ef" +checksum = "ad7c7515609502d316ab9a24f67dc045132d93bfd3f00713389e90d9898bf30d" dependencies = [ "cc", "cxxbridge-cmd", @@ -900,40 +944,40 @@ dependencies = [ [[package]] name = "cxxbridge-cmd" -version = "1.0.133" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c23bfff654d6227cbc83de8e059d2f8678ede5fc3a6c5a35d5c379983cc61e6" +checksum = "6c33fd49f5d956a1b7ee5f7a9768d58580c6752838d92e39d0d56439efdedc35" dependencies = [ "clap", "codespan-reporting", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] name = "cxxbridge-flags" -version = "1.0.133" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c01b36e22051bc6928a78583f1621abaaf7621561c2ada1b00f7878fbe2caa" +checksum = "be0f1077278fac36299cce8446effd19fe93a95eedb10d39265f3bf67b3036c9" [[package]] name = "cxxbridge-macro" -version = "1.0.133" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e14013136fac689345d17b9a6df55977251f11d333c0a571e8d963b55e1f95" +checksum = "3da7e4d6e74af6b79031d264b2f13c3ea70af1978083741c41ffce9308f1f24f" dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] name = "data-encoding" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +checksum = "0e60eed09d8c01d3cee5b7d30acb059b76614c918fa0f992e0dd6eeb10daad6f" [[package]] name = "der" @@ -946,13 +990,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "der-parser" +version = "8.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" +dependencies = [ + "asn1-rs 0.5.2", + "displaydoc", + "nom", + "num-traits 0.2.19", + "rusticata-macros", +] + [[package]] name = "der-parser" version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cd0a5c643689626bec213c4d8bd4d96acc8ffdb4ad4bb6bc16abf27d5f4b553" dependencies = [ - "asn1-rs", + "asn1-rs 0.6.1", "displaydoc", "nom", "num-bigint", @@ -995,7 +1052,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1077,7 +1134,7 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1299,7 +1356,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1750,9 +1807,9 @@ dependencies = [ [[package]] name = "interceptor" -version = "0.13.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ab04c530fd82e414e40394cabe5f0ebfe30d119f10fe29d6e3561926af412e" +checksum = "4705c00485029e738bea8c9505b5ddb1486a8f3627a953e1e77e6abdf5eef90c" dependencies = [ "async-trait", "bytes", @@ -1776,7 +1833,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1891,7 +1948,7 @@ dependencies = [ "serde_bytes", "serde_json", "serde_urlencoded", - "thiserror 2.0.6", + "thiserror 2.0.11", "tokio", "tracing", "url", @@ -1900,7 +1957,7 @@ dependencies = [ [[package]] name = "kittycad-modeling-cmds" -version = "0.2.78" +version = "0.2.91" dependencies = [ "anyhow", "bson", @@ -1923,6 +1980,7 @@ dependencies = [ "serde_json", "slog", "tabled", + "ts-rs", "uuid", "webrtc", ] @@ -1938,12 +1996,12 @@ dependencies = [ "quote", "regex", "rustfmt-wrapper", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] name = "kittycad-modeling-cmds-macros-impl" -version = "0.1.12" +version = "0.1.13" dependencies = [ "anyhow", "criterion", @@ -1952,7 +2010,7 @@ dependencies = [ "quote", "regex", "rustfmt-wrapper", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -1967,7 +2025,7 @@ dependencies = [ "lsystem", "reqwest", "serde_json", - "thiserror 2.0.6", + "thiserror 2.0.11", "tokio", "tokio-tungstenite", "uuid", @@ -1981,7 +2039,7 @@ dependencies = [ "pretty_assertions", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -2010,9 +2068,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.164" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libfuzzer-sys" @@ -2271,7 +2329,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -2327,7 +2385,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c958dd45046245b9c3c2547369bb634eb461670b2e7e0de552905801a648d1d" dependencies = [ - "asn1-rs", + "asn1-rs 0.6.1", ] [[package]] @@ -2377,7 +2435,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -2552,7 +2610,7 @@ dependencies = [ "regex", "regex-syntax 0.8.5", "structmeta", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -2566,7 +2624,7 @@ dependencies = [ "regex", "regex-syntax 0.8.5", "structmeta", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -2758,14 +2816,14 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] @@ -2786,7 +2844,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" dependencies = [ "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -2826,7 +2884,7 @@ dependencies = [ "rustc-hash", "rustls", "socket2", - "thiserror 2.0.6", + "thiserror 2.0.11", "tokio", "tracing", ] @@ -2845,7 +2903,7 @@ dependencies = [ "rustls", "rustls-pki-types", "slab", - "thiserror 2.0.6", + "thiserror 2.0.11", "tinyvec", "tracing", "web-time", @@ -2867,9 +2925,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -3098,9 +3156,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.9" +version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" +checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" dependencies = [ "base64 0.22.1", "bytes", @@ -3136,6 +3194,7 @@ dependencies = [ "tokio", "tokio-native-tls", "tokio-rustls", + "tower", "tower-service", "url", "wasm-bindgen", @@ -3257,9 +3316,9 @@ dependencies = [ [[package]] name = "rtcp" -version = "0.12.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8306430fb118b7834bbee50e744dc34826eca1da2158657a3d6cbc70e24c2096" +checksum = "fc9f775ff89c5fe7f0cc0abafb7c57688ae25ce688f1a52dd88e277616c76ab2" dependencies = [ "bytes", "thiserror 1.0.68", @@ -3268,12 +3327,11 @@ dependencies = [ [[package]] name = "rtp" -version = "0.12.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68baca5b6cb4980678713f0d06ef3a432aa642baefcbfd0f4dd2ef9eb5ab550" +checksum = "6870f09b5db96f8b9e7290324673259fd15519ebb7d55acf8e7eb044a9ead6af" dependencies = [ "bytes", - "memchr", "portable-atomic", "rand 0.8.5", "serde", @@ -3437,7 +3495,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -3448,9 +3506,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sdp" -version = "0.7.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02a526161f474ae94b966ba622379d939a8fe46c930eebbadb73e339622599d5" +checksum = "13254db766b17451aced321e7397ebf0a446ef0c8d2942b6e67a95815421093f" dependencies = [ "rand 0.8.5", "substring", @@ -3497,15 +3555,15 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" [[package]] name = "serde" -version = "1.0.215" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] @@ -3521,13 +3579,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -3538,14 +3596,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" dependencies = [ "indexmap 2.2.6", "itoa", @@ -3618,15 +3676,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "signal-hook-registry" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" -dependencies = [ - "libc", -] - [[package]] name = "signature" version = "2.2.0" @@ -3732,7 +3781,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta-derive", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -3743,7 +3792,7 @@ checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -3765,16 +3814,16 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] name = "stun" -version = "0.7.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea256fb46a13f9204e9dee9982997b2c3097db175a9fddaa8350310d03c4d5a3" +checksum = "28fad383a1cc63ae141e84e48eaef44a1063e9d9e55bcb8f51a99b886486e01b" dependencies = [ - "base64 0.22.1", + "base64 0.21.7", "crc", "lazy_static", "md-5", @@ -3815,9 +3864,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.90" +version = "2.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" +checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" dependencies = [ "proc-macro2", "quote", @@ -3833,6 +3882,18 @@ dependencies = [ "futures-core", ] +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "unicode-xid", +] + [[package]] name = "synstructure" version = "0.13.1" @@ -3841,7 +3902,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -3945,11 +4006,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.6" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" +checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" dependencies = [ - "thiserror-impl 2.0.6", + "thiserror-impl 2.0.11", ] [[package]] @@ -3960,18 +4021,18 @@ checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] name = "thiserror-impl" -version = "2.0.6" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" +checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -4053,9 +4114,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.42.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" +checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" dependencies = [ "backtrace", "bytes", @@ -4063,7 +4124,6 @@ dependencies = [ "mio", "parking_lot 0.12.3", "pin-project-lite", - "signal-hook-registry", "socket2", "tokio-macros", "windows-sys 0.52.0", @@ -4071,13 +4131,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -4173,11 +4233,32 @@ dependencies = [ "walkdir", ] +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -4198,7 +4279,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -4267,6 +4348,31 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "ts-rs" +version = "10.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e640d9b0964e9d39df633548591090ab92f7a4567bc31d3891af23471a3365c6" +dependencies = [ + "lazy_static", + "serde_json", + "thiserror 2.0.11", + "ts-rs-macros", + "uuid", +] + +[[package]] +name = "ts-rs-macros" +version = "10.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9d8656589772eeec2cf7a8264d9cda40fb28b9bc53118ceb9e8c07f8f38730" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", + "termcolor", +] + [[package]] name = "tungstenite" version = "0.24.0" @@ -4287,12 +4393,12 @@ dependencies = [ [[package]] name = "turn" -version = "0.9.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0044fdae001dd8a1e247ea6289abf12f4fcea1331a2364da512f9cd680bbd8cb" +checksum = "8b000cebd930420ac1ed842c8128e3b3412512dfd5b82657eab035a3f5126acc" dependencies = [ "async-trait", - "base64 0.22.1", + "base64 0.21.7", "futures", "log", "md-5", @@ -4360,6 +4466,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "universal-hash" version = "0.5.1" @@ -4402,9 +4514,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +checksum = "744018581f9a3454a9e15beb8a33b017183f1e7c0cd170232a2d1453b23a51c4" dependencies = [ "getrandom", "serde", @@ -4501,7 +4613,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", "wasm-bindgen-shared", ] @@ -4535,7 +4647,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4592,9 +4704,9 @@ dependencies = [ [[package]] name = "webrtc" -version = "0.12.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30367074d9f18231d28a74fab0120856b2b665da108d71a12beab7185a36f97b" +checksum = "d8b3a840e31c969844714f93b5a87e73ee49f3bc2a4094ab9132c69497eb31db" dependencies = [ "arc-swap", "async-trait", @@ -4636,9 +4748,9 @@ dependencies = [ [[package]] name = "webrtc-data" -version = "0.10.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec93b991efcd01b73c5b3503fa8adba159d069abe5785c988ebe14fcf8f05d1" +checksum = "f8b7c550f8d35867b72d511640adf5159729b9692899826fe00ba7fa74f0bf70" dependencies = [ "bytes", "log", @@ -4651,9 +4763,9 @@ dependencies = [ [[package]] name = "webrtc-dtls" -version = "0.11.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c9b89fc909f9da0499283b1112cd98f72fec28e55a54a9e352525ca65cd95c" +checksum = "86e5eedbb0375aa04da93fc3a189b49ed3ed9ee844b6997d5aade14fc3e2c26e" dependencies = [ "aes", "aes-gcm", @@ -4662,7 +4774,7 @@ dependencies = [ "byteorder", "cbc", "ccm", - "der-parser", + "der-parser 8.2.0", "hkdf", "hmac", "log", @@ -4688,9 +4800,9 @@ dependencies = [ [[package]] name = "webrtc-ice" -version = "0.12.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0348b28b593f7709ac98d872beb58c0009523df652c78e01b950ab9c537ff17d" +checksum = "4d4f0ca6d4df8d1bdd34eece61b51b62540840b7a000397bcfb53a7bfcf347c8" dependencies = [ "arc-swap", "async-trait", @@ -4713,9 +4825,9 @@ dependencies = [ [[package]] name = "webrtc-mdns" -version = "0.8.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6dfe9686c6c9c51428da4de415cb6ca2dc0591ce2b63212e23fd9cccf0e316b" +checksum = "c0804694f3b2acfdff48f6df217979b13cb0a00377c63b5effd111daaee7e8c4" dependencies = [ "log", "socket2", @@ -4726,9 +4838,9 @@ dependencies = [ [[package]] name = "webrtc-media" -version = "0.9.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e153be16b8650021ad3e9e49ab6e5fa9fb7f6d1c23c213fd8bbd1a1135a4c704" +checksum = "1c15b20e98167b22949abc1c20eca7c6d814307d187068fe7a48f0b87a4f6d46" dependencies = [ "byteorder", "bytes", @@ -4739,9 +4851,9 @@ dependencies = [ [[package]] name = "webrtc-sctp" -version = "0.11.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5faf3846ec4b7e64b56338d62cbafe084aa79806b0379dff5cc74a8b7a2b3063" +checksum = "1d850daa68639b9d7bb16400676e97525d1e52b15b4928240ae2ba0e849817a5" dependencies = [ "arc-swap", "async-trait", @@ -4757,9 +4869,9 @@ dependencies = [ [[package]] name = "webrtc-srtp" -version = "0.14.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771db9993712a8fb3886d5be4613ebf27250ef422bd4071988bf55f1ed1a64fa" +checksum = "fbec5da43a62c228d321d93fb12cc9b4d9c03c9b736b0c215be89d8bd0774cfe" dependencies = [ "aead", "aes", @@ -4780,9 +4892,9 @@ dependencies = [ [[package]] name = "webrtc-util" -version = "0.10.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1438a8fd0d69c5775afb4a71470af92242dbd04059c61895163aa3c1ef933375" +checksum = "dc8d9bc631768958ed97b8d68b5d301e63054ae90b09083d43e2fefb939fd77e" dependencies = [ "async-trait", "bitflags 1.3.2", @@ -5050,9 +5162,9 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcbc162f30700d6f3f82a24bf7cc62ffe7caea42c0b2cba8bf7f3ae50cf51f69" dependencies = [ - "asn1-rs", + "asn1-rs 0.6.1", "data-encoding", - "der-parser", + "der-parser 9.0.0", "lazy_static", "nom", "oid-registry", @@ -5103,7 +5215,7 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] @@ -5123,7 +5235,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.96", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 16a406b2..b9d67e35 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,9 +21,9 @@ kittycad-modeling-cmds = { path = "modeling-cmds", version = "0.2.0" } kittycad-modeling-cmds-macros = { path = "modeling-cmds-macros", version = "0.1.11" } kittycad-modeling-cmds-macros-impl = { path = "modeling-cmds-macros-impl", version = "0.1.12" } kittycad-modeling-session = { path = "modeling-session", version = "0.1.2" } -proc-macro2 = "1.0.92" -quote = "1.0.37" -syn = "2.0.90" +proc-macro2 = "1.0.93" +quote = "1.0.38" +syn = "2.0.96" [profile.bench] debug = true diff --git a/bumper/Cargo.toml b/bumper/Cargo.toml index d48815b8..b7a694e7 100644 --- a/bumper/Cargo.toml +++ b/bumper/Cargo.toml @@ -10,10 +10,10 @@ publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -anyhow = "1.0.94" -clap = { version = "4.5.23", features = ["derive"] } -semver = "1.0.22" -serde = "1.0.215" +anyhow = "1.0.95" +clap = { version = "4.5.26", features = ["derive"] } +semver = "1.0.24" +serde = "1.0.217" toml_edit = "0.22.16" [lints] diff --git a/modeling-cmds-macros-impl/Cargo.toml b/modeling-cmds-macros-impl/Cargo.toml index 939ebb4f..7795b377 100644 --- a/modeling-cmds-macros-impl/Cargo.toml +++ b/modeling-cmds-macros-impl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kittycad-modeling-cmds-macros-impl" -version = "0.1.12" +version = "0.1.13" edition = "2021" repository = "https://github.com/KittyCAD/modeling-api" rust-version = "1.73" @@ -16,7 +16,7 @@ quote = { workspace = true } syn = { workspace = true, features = ["extra-traits", "full"] } [dev-dependencies] -anyhow = "1.0.94" +anyhow = "1.0.95" criterion = { version = "0.5", features = ["html_reports"] } insta = "1.41.1" regex = "1.11.1" diff --git a/modeling-cmds-macros-impl/src/modeling_cmd_enum.rs b/modeling-cmds-macros-impl/src/modeling_cmd_enum.rs index 3573827f..88762581 100644 --- a/modeling-cmds-macros-impl/src/modeling_cmd_enum.rs +++ b/modeling-cmds-macros-impl/src/modeling_cmd_enum.rs @@ -54,9 +54,11 @@ pub fn generate(input: ItemMod) -> TokenStream { /// Definition of each modeling command. #input /// Commands that the KittyCAD engine can execute. - #[derive(Debug, Clone, Serialize, Deserialize)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "derive-jsonschema-on-enums", derive(schemars::JsonSchema))] #[serde(rename_all = "snake_case", tag = "type")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)] pub enum ModelingCmd {#( #[doc = #docs] diff --git a/modeling-cmds-macros/Cargo.toml b/modeling-cmds-macros/Cargo.toml index a45607e7..8b846fb3 100644 --- a/modeling-cmds-macros/Cargo.toml +++ b/modeling-cmds-macros/Cargo.toml @@ -20,7 +20,7 @@ syn = { workspace = true, features = ["extra-traits", "full"] } proc-macro = true [dev-dependencies] -anyhow = "1.0.94" +anyhow = "1.0.95" insta = "1.41.1" regex = "1.11.1" rustfmt-wrapper = "0.2.1" diff --git a/modeling-cmds/Cargo.toml b/modeling-cmds/Cargo.toml index c0613951..4d259678 100644 --- a/modeling-cmds/Cargo.toml +++ b/modeling-cmds/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kittycad-modeling-cmds" -version = "0.2.78" +version = "0.2.91" edition = "2021" authors = ["KittyCAD, Inc."] description = "Commands in the KittyCAD Modeling API" @@ -11,10 +11,10 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -anyhow = "1.0.94" +anyhow = "1.0.95" chrono = "0.4.39" cxx = { version = "1.0", optional = true } -data-encoding = "2.5.0" +data-encoding = "2.7.0" enum-iterator = "2.1.0" enum-iterator-derive = "1.2.1" euler = "0.4.1" @@ -31,13 +31,18 @@ schemars = { version = "0.8.16", features = [ "url", "uuid1", ] } -serde = { version = "1.0.215", features = ["derive"] } +serde = { version = "1.0.217", features = ["derive"] } serde_bytes = "0.11.15" -serde_json = { version = "1.0.133", optional = true } +serde_json = { version = "1.0.135", optional = true } slog = { version = "2.7.0", optional = true } tabled = { version = "0.17", optional = true } -uuid = { version = "1.11.0", features = ["serde", "v4", "js"] } -webrtc = { version = "0.12", optional = true } +ts-rs = { version = "10.1.0", optional = true, features = [ + "uuid-impl", + "no-serde-warnings", + "serde-json-impl", +] } +uuid = { version = "1.12.0", features = ["serde", "v4", "js"] } +webrtc = { version = "0.11", optional = true } [lints] workspace = true @@ -46,6 +51,7 @@ workspace = true default = [] derive-jsonschema-on-enums = [] tabled = ["dep:tabled"] +ts-rs = ["dep:ts-rs"] slog = ["dep:slog"] cxx = ["dep:cxx"] convert_client_crate = ["dep:kittycad"] diff --git a/modeling-cmds/src/coord.rs b/modeling-cmds/src/coord.rs index 7b382f82..d9781873 100644 --- a/modeling-cmds/src/coord.rs +++ b/modeling-cmds/src/coord.rs @@ -10,6 +10,8 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[serde(rename_all = "snake_case")] #[display(style = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum Axis { /// 'Y' axis. Y = 1, @@ -21,6 +23,8 @@ pub enum Axis { #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[serde(rename_all = "snake_case")] #[display(style = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum Direction { /// Increasing numbers. Positive = 1, @@ -42,6 +46,8 @@ impl std::ops::Mul for Direction { /// An [`Axis`] paired with a [`Direction`]. #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[display("({axis}, {direction})")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct AxisDirectionPair { /// Axis specifier. pub axis: Axis, @@ -59,6 +65,8 @@ pub struct AxisDirectionPair { /// [cglearn.eu](https://cglearn.eu/pub/computer-graphics/introduction-to-geometry#material-coordinate-systems-1) #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[display("forward: {forward}, up: {up}")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct System { /// Axis the front face of a model looks along. pub forward: AxisDirectionPair, diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index f9d9f1bc..86ef5d99 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -22,8 +22,10 @@ define_modeling_cmd_enum! { length_unit::LengthUnit, shared::{ Angle, + ComponentTransform, CutType, CameraMovement, + ExtrudedFaceInfo, AnnotationOptions, AnnotationType, CameraDragInteractionType, Color, DistanceType, EntityType, PathComponentConstraintBound, PathComponentConstraintType, PathSegment, PerspectiveCameraParameters, Point2d, Point3d, SceneSelectionType, SceneToolType, @@ -43,8 +45,10 @@ define_modeling_cmd_enum! { /// Evaluates the position of a path in one shot (engine utility for kcl executor) #[derive( - Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, + Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EngineUtilEvaluatePath { /// The path in json form (the serialized result of the kcl Sketch/Path object pub path_json: String, @@ -55,9 +59,11 @@ define_modeling_cmd_enum! { /// Start a new path. #[derive( - Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, + Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, )] - pub struct StartPath; + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct StartPath {} /// Move the path's "pen". /// If you're in sketch mode, these coordinates are in the local coordinate system, @@ -67,8 +73,10 @@ define_modeling_cmd_enum! { /// to (1, 1, 0) with this command uses local coordinates. So, it would move the pen to /// (1, 1, 50) in global coordinates. #[derive( - Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, + Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct MovePathPen { /// The ID of the command which created the path. pub path: ModelingCmdId, @@ -79,8 +87,10 @@ define_modeling_cmd_enum! { /// Extend a path by adding a new segment which starts at the path's "pen". /// If no "pen" location has been set before (via `MovePen`), then the pen is at the origin. #[derive( - Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, + Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ExtendPath { /// The ID of the command which created the path. pub path: ModelingCmdId, @@ -91,20 +101,28 @@ define_modeling_cmd_enum! { /// Command for extruding a solid 2d. #[derive( - Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, + Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Extrude { /// Which sketch to extrude. /// Must be a closed 2D solid. pub target: ModelingCmdId, /// How far off the plane to extrude pub distance: LengthUnit, + /// Which IDs should the new faces have? + /// If this isn't given, the engine will generate IDs. + #[serde(default)] + pub faces: Option, } /// Extrude the object along a path. #[derive( - Clone, Debug, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, + Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Sweep { /// Which sketch to sweep. /// Must be a closed 2D solid. @@ -119,8 +137,10 @@ define_modeling_cmd_enum! { /// Command for revolving a solid 2d. #[derive( - Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, + Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Revolve { /// Which sketch to revolve. /// Must be a closed 2D solid. @@ -139,8 +159,10 @@ define_modeling_cmd_enum! { /// Command for shelling a solid3d face #[derive( - Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, + Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Solid3dShellFace { /// Which Solid3D is being shelled. pub object_id: Uuid, @@ -156,8 +178,10 @@ define_modeling_cmd_enum! { /// Command for revolving a solid 2d about a brep edge #[derive( - Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, + Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct RevolveAboutEdge { /// Which sketch to revolve. /// Must be a closed 2D solid. @@ -172,8 +196,10 @@ define_modeling_cmd_enum! { /// Command for lofting sections to create a solid #[derive( - Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant + Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Loft { /// The closed section curves to create a lofted solid from. /// Currently, these must be Solid2Ds @@ -194,15 +220,19 @@ define_modeling_cmd_enum! { /// Closes a path, converting it to a 2D solid. #[derive( - Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, + Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ClosePath { /// Which path to close. pub path_id: Uuid, } /// Camera drag started. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct CameraDragStart { /// The type of camera drag interaction. pub interaction: CameraDragInteractionType, @@ -211,7 +241,9 @@ define_modeling_cmd_enum! { } /// Camera drag continued. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct CameraDragMove { /// The type of camera drag interaction. pub interaction: CameraDragInteractionType, @@ -225,7 +257,9 @@ define_modeling_cmd_enum! { } /// Camera drag ended - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct CameraDragEnd { /// The type of camera drag interaction. pub interaction: CameraDragInteractionType, @@ -234,11 +268,15 @@ define_modeling_cmd_enum! { } /// Gets the default camera's camera settings - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] - pub struct DefaultCameraGetSettings; + #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct DefaultCameraGetSettings {} /// Change what the default camera is looking at. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct DefaultCameraLookAt { /// Where the camera is positioned pub vantage: Point3d, @@ -254,7 +292,9 @@ define_modeling_cmd_enum! { } /// Change what the default camera is looking at. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct DefaultCameraPerspectiveSettings { /// Where the camera is positioned pub vantage: Point3d, @@ -276,7 +316,9 @@ define_modeling_cmd_enum! { } /// Adjust zoom of the default camera. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct DefaultCameraZoom { /// Move the camera forward along the vector it's looking at, /// by this magnitudedefaultCameraZoom. @@ -285,7 +327,9 @@ define_modeling_cmd_enum! { } /// Export the scene to a file. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Export { /// IDs of the entities to be exported. If this is empty, then all entities are exported. pub entity_ids: Vec, @@ -294,21 +338,27 @@ define_modeling_cmd_enum! { } /// What is this entity's parent? - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EntityGetParentId { /// ID of the entity being queried. pub entity_id: Uuid, } /// How many children does the entity have? - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EntityGetNumChildren { /// ID of the entity being queried. pub entity_id: Uuid, } /// What is the UUID of this entity's n-th child? - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EntityGetChildUuid { /// ID of the entity being queried. pub entity_id: Uuid, @@ -317,21 +367,27 @@ define_modeling_cmd_enum! { } /// What are all UUIDs of this entity's children? - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EntityGetAllChildUuids { /// ID of the entity being queried. pub entity_id: Uuid, } /// What are all UUIDs of all the paths sketched on top of this entity? - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EntityGetSketchPaths { /// ID of the entity being queried. pub entity_id: Uuid, } /// What is the distance between these two entities? - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EntityGetDistance { /// ID of the first entity being queried. pub entity_id1: Uuid, @@ -343,7 +399,9 @@ define_modeling_cmd_enum! { /// Create a pattern using this entity by specifying the transform for each desired repetition. /// Transformations are performed in the following order (first applied to last applied): scale, rotate, translate. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EntityLinearPatternTransform { /// ID of the entity being copied. pub entity_id: Uuid, @@ -360,7 +418,9 @@ define_modeling_cmd_enum! { } /// Create a linear pattern using this entity. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EntityLinearPattern { /// ID of the entity being copied. pub entity_id: Uuid, @@ -373,7 +433,9 @@ define_modeling_cmd_enum! { pub spacing: LengthUnit, } /// Create a circular pattern using this entity. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EntityCircularPattern { /// ID of the entity being copied. pub entity_id: Uuid, @@ -392,13 +454,16 @@ define_modeling_cmd_enum! { } /// Create a helix using the input cylinder and other specified parameters. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EntityMakeHelix { /// ID of the cylinder. pub cylinder_id: Uuid, /// Number of revolutions. pub revolutions: f64, - /// Start angle (in degrees). + /// Start angle. + #[serde(default)] pub start_angle: Angle, /// Is the helix rotation clockwise? pub is_clockwise: bool, @@ -406,8 +471,52 @@ define_modeling_cmd_enum! { pub length: LengthUnit, } + /// Create a helix using the specified parameters. + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct EntityMakeHelixFromParams { + /// Radius of the helix. + pub radius: f64, + /// Length of the helix. + pub length: LengthUnit, + /// Number of revolutions. + pub revolutions: f64, + /// Start angle. + #[serde(default)] + pub start_angle: Angle, + /// Is the helix rotation clockwise? + pub is_clockwise: bool, + /// Center of the helix at the base of the helix. + pub center: Point3d, + /// Axis of the helix. The helix will be created around and in the direction of this axis. + pub axis: Point3d, + } + + /// Create a helix using the specified parameters. + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct EntityMakeHelixFromEdge { + /// Radius of the helix. + pub radius: f64, + /// Length of the helix. If None, the length of the edge will be used instead. + pub length: Option, + /// Number of revolutions. + pub revolutions: f64, + /// Start angle. + #[serde(default)] + pub start_angle: Angle, + /// Is the helix rotation clockwise? + pub is_clockwise: bool, + /// Edge about which to make the helix. + pub edge_id: Uuid, + } + /// Mirror the input entities over the specified axis. (Currently only supports sketches) - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EntityMirror { /// ID of the mirror entities. pub ids: Vec, @@ -419,9 +528,11 @@ define_modeling_cmd_enum! { /// Mirror the input entities over the specified edge. (Currently only supports sketches) #[derive( - Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, + Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, )] - pub struct EntityMirrorAcrossEdge { + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct EntityMirrorAcrossEdge { /// ID of the mirror entities. pub ids: Vec, /// The edge to use as the mirror axis, must be linear and lie in the plane of the solid @@ -430,7 +541,9 @@ define_modeling_cmd_enum! { /// Modifies the selection by simulating a "mouse click" at the given x,y window coordinate /// Returns ID of whatever was selected. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct SelectWithPoint { /// Where in the window was selected pub selected_at_window: Point2d, @@ -439,25 +552,33 @@ define_modeling_cmd_enum! { } /// Adds one or more entities (by UUID) to the selection. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct SelectAdd { /// Which entities to select pub entities: Vec, } /// Removes one or more entities (by UUID) from the selection. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct SelectRemove { /// Which entities to unselect pub entities: Vec, } /// Removes all of the Objects in the scene - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] - pub struct SceneClearAll; + #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct SceneClearAll {} /// Replaces current selection with these entities (by UUID). - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct SelectReplace { /// Which entities to select pub entities: Vec, @@ -465,7 +586,9 @@ define_modeling_cmd_enum! { /// Changes the current highlighted entity to whichever one is at the given window coordinate. /// If there's no entity at this location, clears the highlight. - #[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct HighlightSetEntity { /// Coordinates of the window being clicked pub selected_at_window: Point2d, @@ -477,14 +600,18 @@ define_modeling_cmd_enum! { } /// Changes the current highlighted entity to these entities. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct HighlightSetEntities { /// Highlight these entities. pub entities: Vec, } /// Create a new annotation - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct NewAnnotation { /// What should the annotation contain? pub options: AnnotationOptions, @@ -495,7 +622,9 @@ define_modeling_cmd_enum! { } /// Update an annotation - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct UpdateAnnotation { /// Which annotation to update pub annotation_id: Uuid, @@ -505,14 +634,18 @@ define_modeling_cmd_enum! { } /// Changes visibility of scene-wide edge lines on brep solids - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EdgeLinesVisible { /// Whether or not the edge lines should be hidden. pub hidden: bool, } /// Hide or show an object - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ObjectVisible { /// Which object to change pub object_id: Uuid, @@ -521,14 +654,18 @@ define_modeling_cmd_enum! { } /// Bring an object to the front of the scene - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ObjectBringToFront { /// Which object to change pub object_id: Uuid, } /// Set the material properties of an object - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ObjectSetMaterialParamsPbr { /// Which object to change pub object_id: Uuid, @@ -542,14 +679,18 @@ define_modeling_cmd_enum! { pub ambient_occlusion: f32, } /// What type of entity is this? - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct GetEntityType { /// ID of the entity being queried. pub entity_id: Uuid, } /// Gets all faces which use the given edge. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Solid3dGetAllEdgeFaces { /// Which object is being queried. pub object_id: Uuid, @@ -558,7 +699,9 @@ define_modeling_cmd_enum! { } /// Add a hole to a Solid2d object before extruding it. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Solid2dAddHole { /// Which object to add the hole to. pub object_id: Uuid, @@ -567,7 +710,9 @@ define_modeling_cmd_enum! { } /// Gets all edges which are opposite the given edge, across all possible faces. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Solid3dGetAllOppositeEdges { /// Which object is being queried. pub object_id: Uuid, @@ -578,7 +723,9 @@ define_modeling_cmd_enum! { } /// Gets the edge opposite the given edge, along the given face. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Solid3dGetOppositeEdge { /// Which object is being queried. pub object_id: Uuid, @@ -589,7 +736,9 @@ define_modeling_cmd_enum! { } /// Gets the next adjacent edge for the given edge, along the given face. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Solid3dGetNextAdjacentEdge { /// Which object is being queried. pub object_id: Uuid, @@ -600,7 +749,9 @@ define_modeling_cmd_enum! { } /// Gets the previous adjacent edge for the given edge, along the given face. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Solid3dGetPrevAdjacentEdge { /// Which object is being queried. pub object_id: Uuid, @@ -611,7 +762,9 @@ define_modeling_cmd_enum! { } /// Gets the shared edge between these two faces if it exists - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Solid3dGetCommonEdge { /// Which object is being queried. pub object_id: Uuid, @@ -620,7 +773,9 @@ define_modeling_cmd_enum! { } /// Fillets the given edge with the specified radius. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Solid3dFilletEdge { /// Which object is being filletted. pub object_id: Uuid, @@ -640,14 +795,18 @@ define_modeling_cmd_enum! { } /// Determines whether a brep face is planar and returns its surface-local planar axes if so - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct FaceIsPlanar { /// Which face is being queried. pub object_id: Uuid, } /// Determines a position on a brep face evaluated by parameters u,v - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct FaceGetPosition { /// Which face is being queried. pub object_id: Uuid, @@ -657,14 +816,18 @@ define_modeling_cmd_enum! { } ///Obtains the surface "center of mass" - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct FaceGetCenter { /// Which face is being queried. pub object_id: Uuid, } /// Determines the gradient (dFdu, dFdv) + normal vector on a brep face evaluated by parameters u,v - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct FaceGetGradient { /// Which face is being queried. pub object_id: Uuid, @@ -674,7 +837,9 @@ define_modeling_cmd_enum! { } /// Send object to front or back. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct SendObject { /// Which object is being changed. pub object_id: Uuid, @@ -682,7 +847,9 @@ define_modeling_cmd_enum! { pub front: bool, } /// Set opacity of the entity. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EntitySetOpacity { /// Which entity is being changed. pub entity_id: Uuid, @@ -693,7 +860,9 @@ define_modeling_cmd_enum! { } /// Fade entity in or out. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EntityFade { /// Which entity is being changed. pub entity_id: Uuid, @@ -705,7 +874,9 @@ define_modeling_cmd_enum! { } /// Make a new plane - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct MakePlane { /// Origin of the plane pub origin: Point3d, @@ -724,7 +895,9 @@ define_modeling_cmd_enum! { } /// Set the color of a plane. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct PlaneSetColor { /// Which plane is being changed. pub plane_id: Uuid, @@ -733,14 +906,18 @@ define_modeling_cmd_enum! { } /// Set the current tool. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct SetTool { /// What tool should be active. pub tool: SceneToolType, } /// Send a mouse move event - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct MouseMove { /// Where the mouse is pub window: Point2d, @@ -753,7 +930,9 @@ define_modeling_cmd_enum! { /// Send a mouse click event /// Updates modified/selected entities. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct MouseClick { /// Where the mouse is pub window: Point2d, @@ -762,15 +941,21 @@ define_modeling_cmd_enum! { /// Disable sketch mode. /// If you are sketching on a face, be sure to not disable sketch mode until you have extruded. /// Otherwise, your object will not be fused with the face. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] - pub struct SketchModeDisable; + #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct SketchModeDisable {} /// Get the plane for sketch mode. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] - pub struct GetSketchModePlane; + #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct GetSketchModePlane {} /// Get the plane for sketch mode. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct CurveSetConstraint { /// Which curve to constrain. pub object_id: Uuid, @@ -781,7 +966,9 @@ define_modeling_cmd_enum! { } /// Sketch on some entity (e.g. a plane, a face). - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct EnableSketchMode { /// Which entity to sketch on. pub entity_id: Uuid, @@ -800,54 +987,70 @@ define_modeling_cmd_enum! { /// Sets whether or not changes to the scene or its objects will be done as a "dry run" /// In a dry run, successful commands won't actually change the model. /// This is useful for catching errors before actually making the change. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] - pub struct EnableDryRun; + #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct EnableDryRun {} /// Sets whether or not changes to the scene or its objects will be done as a "dry run" /// In a dry run, successful commands won't actually change the model. /// This is useful for catching errors before actually making the change. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] - pub struct DisableDryRun; + #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct DisableDryRun {} /// Set the background color of the scene. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct SetBackgroundColor { /// The color to set the background to. pub color: Color, } /// Set the properties of the tool lines for the scene. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct SetCurrentToolProperties { /// The color to set the tool line to. pub color: Option, } /// Set the default system properties used when a specific property isn't set. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct SetDefaultSystemProperties { /// The default system color. pub color: Option, } /// Get type of the given curve. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct CurveGetType { /// Which curve to query. pub curve_id: Uuid, } /// Get control points of the given curve. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct CurveGetControlPoints { /// Which curve to query. pub curve_id: Uuid, } /// Enum containing the variety of image formats snapshots may be exported to. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, FromStr, Display)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)] #[serde(rename_all = "snake_case")] #[display(style = "snake_case")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum ImageFormat { /// .png format Png, @@ -856,14 +1059,18 @@ define_modeling_cmd_enum! { } /// Take a snapshot of the current view. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct TakeSnapshot { /// What image format to return. pub format: ImageFormat, } /// Add a gizmo showing the axes. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct MakeAxesGizmo { /// If true, axes gizmo will be placed in the corner of the screen. /// If false, it will be placed at the origin of the scene. @@ -873,14 +1080,18 @@ define_modeling_cmd_enum! { } /// Query the given path. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct PathGetInfo { /// Which path to query pub path_id: Uuid, } /// Obtain curve ids for vertex ids - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct PathGetCurveUuidsForVertices { /// Which path to query pub path_id: Uuid, @@ -890,7 +1101,9 @@ define_modeling_cmd_enum! { } /// Obtain curve id by index - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct PathGetCurveUuid { /// Which path to query pub path_id: Uuid, @@ -900,28 +1113,36 @@ define_modeling_cmd_enum! { } /// Obtain vertex ids for a path - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct PathGetVertexUuids { /// Which path to query pub path_id: Uuid, } /// Obtain the sketch target id (if the path was drawn in sketchmode) for a path - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct PathGetSketchTargetUuid { /// Which path to query pub path_id: Uuid, } /// Start dragging the mouse. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct HandleMouseDragStart { /// The mouse position. pub window: Point2d, } /// Continue dragging the mouse. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct HandleMouseDragMove { /// The mouse position. pub window: Point2d, @@ -933,14 +1154,18 @@ define_modeling_cmd_enum! { } /// Stop dragging the mouse. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct HandleMouseDragEnd { /// The mouse position. pub window: Point2d, } /// Remove scene objects. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct RemoveSceneObjects { /// Objects to remove. pub object_ids: HashSet, @@ -948,7 +1173,9 @@ define_modeling_cmd_enum! { /// Utility method. Performs both a ray cast and projection to plane-local coordinates. /// Returns the plane coordinates for the given window coordinates. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct PlaneIntersectAndProject { /// The plane you're intersecting against. pub plane_id: Uuid, @@ -957,14 +1184,18 @@ define_modeling_cmd_enum! { } /// Find the start and end of a curve. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct CurveGetEndPoints { /// ID of the curve being queried. pub curve_id: Uuid, } /// Reconfigure the stream. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ReconfigureStream { /// Width of the stream. pub width: u32, @@ -979,6 +1210,8 @@ define_modeling_cmd_enum! { /// Import files to the current model. #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ImportFiles { /// Files to import. pub files: Vec, @@ -988,14 +1221,18 @@ define_modeling_cmd_enum! { /// Set the units of the scene. /// For all following commands, the units will be interpreted as the given units. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct SetSceneUnits { /// Which units the scene uses. pub unit: units::UnitLength, } /// Get the mass of entities in the scene or the default scene. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Mass { /// IDs of the entities to get the mass of. If this is empty, then the default scene is included in /// the mass. @@ -1009,7 +1246,9 @@ define_modeling_cmd_enum! { } /// Get the density of entities in the scene or the default scene. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Density { /// IDs of the entities to get the density of. If this is empty, then the default scene is included in /// the density. @@ -1023,7 +1262,9 @@ define_modeling_cmd_enum! { } /// Get the volume of entities in the scene or the default scene. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Volume { /// IDs of the entities to get the volume of. If this is empty, then the default scene is included in /// the volume. @@ -1033,7 +1274,9 @@ define_modeling_cmd_enum! { } /// Get the center of mass of entities in the scene or the default scene. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct CenterOfMass { /// IDs of the entities to get the center of mass of. If this is empty, then the default scene is included in /// the center of mass. @@ -1043,7 +1286,9 @@ define_modeling_cmd_enum! { } /// Get the surface area of entities in the scene or the default scene. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct SurfaceArea { /// IDs of the entities to get the surface area of. If this is empty, then the default scene is included in /// the surface area. @@ -1054,16 +1299,20 @@ define_modeling_cmd_enum! { /// Focus the default camera upon an object in the scene. #[derive( - Clone, Debug, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, + Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct DefaultCameraFocusOn { /// UUID of object to focus on. pub uuid: Uuid, } /// When you select some entity with the current tool, what should happen to the entity? #[derive( - Clone, Debug, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, + Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct SetSelectionType { /// What type of selection should occur when you select something? pub selection_type: SceneSelectionType, @@ -1071,8 +1320,10 @@ define_modeling_cmd_enum! { /// What kind of entities can be selected? #[derive( - Clone, Debug, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, + Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct SetSelectionFilter { /// If vector is empty, clear all filters. /// If vector is non-empty, only the given entity types will be selectable. @@ -1081,14 +1332,18 @@ define_modeling_cmd_enum! { /// Use orthographic projection. #[derive( - Clone, Debug, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, + Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, )] - pub struct DefaultCameraSetOrthographic; + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct DefaultCameraSetOrthographic {} /// Use perspective projection. #[derive( - Clone, Debug, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, + Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct DefaultCameraSetPerspective { /// If this is not given, use the same parameters as last time the perspective camera was used. pub parameters: Option, @@ -1097,8 +1352,10 @@ define_modeling_cmd_enum! { ///Updates the camera to center to the center of the current selection ///(or the origin if nothing is selected) #[derive( - Clone, Debug, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, + Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct DefaultCameraCenterToSelection { /// Dictates whether or not the camera position should be adjusted during this operation /// If no movement is requested, the camera will orbit around the new center from its current position @@ -1108,8 +1365,10 @@ define_modeling_cmd_enum! { ///Updates the camera to center to the center of the current scene's bounds #[derive( - Clone, Debug, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, + Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct DefaultCameraCenterToScene { /// Dictates whether or not the camera position should be adjusted during this operation /// If no movement is requested, the camera will orbit around the new center from its current position @@ -1118,7 +1377,9 @@ define_modeling_cmd_enum! { } /// Fit the view to the specified object(s). - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ZoomToFit { /// Which objects to fit camera to; if empty, fit to all non-default objects. Defaults to empty vector. #[serde(default = "default_uuid_vector")] @@ -1151,7 +1412,9 @@ define_modeling_cmd_enum! { } /// Fit the view to the scene with an isometric view. - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ViewIsometric { /// How much to pad the view frame by, as a fraction of the object(s) bounding box size. /// Negative padding will crop the view of the object proportionally. @@ -1162,7 +1425,9 @@ define_modeling_cmd_enum! { } /// Get a concise description of all of an extrusion's faces. - #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)] + #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Solid3dGetExtrusionFaceInfo { /// The Solid3d object whose extrusion is being queried. pub object_id: Uuid, @@ -1171,24 +1436,43 @@ define_modeling_cmd_enum! { } /// Clear the selection - #[derive( - Clone, Debug, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, - )] - pub struct SelectClear; + #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct SelectClear {} /// Find all IDs of selected entities - #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)] - pub struct SelectGet; + #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct SelectGet {} /// Get the number of objects in the scene #[derive( - Clone, Debug, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, + Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, )] - pub struct GetNumObjects; + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct GetNumObjects {} + ///Set the transform of an object. + #[derive( + Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant, + )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct SetObjectTransform + { + /// Id of the object whose transform is to be set. + pub object_id: Uuid, + /// List of transforms to be applied to the object. + pub transforms: Vec, + } /// Make a new path by offsetting an object by a given distance. /// The new path's ID will be the ID of this command. - #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)] + #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct MakeOffsetPath { /// The object that will be offset (can be a path, sketch, or a solid) pub object_id: Uuid, @@ -1201,6 +1485,17 @@ define_modeling_cmd_enum! { /// The distance to offset the path (positive for outset, negative for inset) pub offset: LengthUnit, } + + /// Add a hole to a closed path by offsetting it a uniform distance inward. + #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct AddHoleFromOffset { + /// The closed path to add a hole to. + pub object_id: Uuid, + /// The distance to offset the path (positive for outset, negative for inset) + pub offset: LengthUnit, + } } } @@ -1232,6 +1527,8 @@ impl ModelingCmd { /// If you are sending binary data for a file, be sure to send the WebSocketRequest as /// binary/bson, not text/json. #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ImportFile { /// The file's full path, including file extension. pub path: String, diff --git a/modeling-cmds/src/format/fbx.rs b/modeling-cmds/src/format/fbx.rs index cc664aa5..f1411d19 100644 --- a/modeling-cmds/src/format/fbx.rs +++ b/modeling-cmds/src/format/fbx.rs @@ -8,22 +8,11 @@ use serde::{Deserialize, Serialize}; pub mod import { use super::*; /// Options for importing FBX. - #[derive( - Clone, - Debug, - Default, - Eq, - Hash, - PartialEq, - Serialize, - Deserialize, - JsonSchema, - Display, - FromStr, - - )] + #[derive(Clone, Debug, Default, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[display("")] #[serde(rename = "FbxImportOptions")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Options {} } @@ -34,6 +23,8 @@ pub mod export { /// Options for exporting FBX. #[derive(Clone, Debug, Default, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema)] #[serde(rename = "FbxExportOptions")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Options { /// Specifies which kind of FBX will be exported. pub storage: Storage, @@ -64,22 +55,12 @@ pub mod export { /// Describes the storage format of an FBX file. #[derive( - Default, - Clone, - Copy, - Debug, - Eq, - Hash, - PartialEq, - Serialize, - Deserialize, - JsonSchema, - Display, - FromStr, - + Default, Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr, )] #[display(style = "snake_case")] #[serde(rename = "FbxStorage", rename_all = "snake_case")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum Storage { /// ASCII FBX encoding. Ascii, diff --git a/modeling-cmds/src/format/gltf.rs b/modeling-cmds/src/format/gltf.rs index e9ea9627..3f359afe 100644 --- a/modeling-cmds/src/format/gltf.rs +++ b/modeling-cmds/src/format/gltf.rs @@ -1,4 +1,3 @@ - use parse_display::{Display, FromStr}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -8,22 +7,11 @@ pub mod import { use super::*; /// Options for importing glTF 2.0. - #[derive( - Clone, - Debug, - Default, - Eq, - Hash, - PartialEq, - Serialize, - Deserialize, - JsonSchema, - Display, - FromStr, - - )] + #[derive(Clone, Debug, Default, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[display("")] #[serde(rename = "GltfImportOptions")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Options {} } @@ -34,6 +22,8 @@ pub mod export { #[derive(Default, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[display("storage: {storage}, presentation: {presentation}")] #[serde(rename = "GltfExportOptions")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Options { /// Specifies which kind of glTF 2.0 will be exported. pub storage: Storage, @@ -47,6 +37,8 @@ pub mod export { )] #[display(style = "snake_case")] #[serde(rename = "GltfStorage", rename_all = "snake_case")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum Storage { /// Binary glTF 2.0. /// @@ -75,6 +67,8 @@ pub mod export { )] #[display(style = "snake_case")] #[serde(rename = "GltfPresentation", rename_all = "snake_case")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum Presentation { /// Condense the JSON into the smallest possible size. Compact, diff --git a/modeling-cmds/src/format/mod.rs b/modeling-cmds/src/format/mod.rs index 4d04a56f..df404138 100644 --- a/modeling-cmds/src/format/mod.rs +++ b/modeling-cmds/src/format/mod.rs @@ -27,6 +27,8 @@ pub mod sldprt; #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[serde(tag = "type", rename_all = "snake_case")] #[display(style = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum OutputFormat { /// Autodesk Filmbox (FBX) format. #[display("{}: {0}")] @@ -55,6 +57,8 @@ pub enum OutputFormat { #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[serde(tag = "type", rename_all = "snake_case")] #[display(style = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum InputFormat { /// Autodesk Filmbox (FBX) format. #[display("{}: {0}")] @@ -85,6 +89,8 @@ pub enum InputFormat { #[derive(Clone, Debug, Default, Display, Eq, FromStr, Hash, PartialEq, JsonSchema, Deserialize, Serialize)] #[display(style = "snake_case")] #[serde(rename_all = "snake_case", tag = "type")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum Selection { /// Visit the default scene. #[default] diff --git a/modeling-cmds/src/format/obj.rs b/modeling-cmds/src/format/obj.rs index d922bf4f..fe0da3d8 100644 --- a/modeling-cmds/src/format/obj.rs +++ b/modeling-cmds/src/format/obj.rs @@ -1,4 +1,3 @@ - use parse_display::{Display, FromStr}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -10,11 +9,11 @@ pub mod import { use super::*; /// Options for importing OBJ. - #[derive( - Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr, - )] + #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[display("coords: {coords}, units: {units}")] #[serde(rename = "ObjImportOptions")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Options { /// Co-ordinate system of input data. /// @@ -48,6 +47,8 @@ pub mod export { #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[display("coords: {coords}, units: {units}")] #[serde(rename = "ObjExportOptions")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Options { /// Co-ordinate system of output data. /// diff --git a/modeling-cmds/src/format/ply.rs b/modeling-cmds/src/format/ply.rs index d45293db..f11550bc 100644 --- a/modeling-cmds/src/format/ply.rs +++ b/modeling-cmds/src/format/ply.rs @@ -1,4 +1,3 @@ - use parse_display::{Display, FromStr}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -10,11 +9,11 @@ pub mod import { use super::*; /// Options for importing PLY. - #[derive( - Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr, - )] + #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[display("coords: {coords}, units: {units}")] #[serde(rename = "PlyImportOptions")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Options { /// Co-ordinate system of input data. /// @@ -48,6 +47,8 @@ pub mod export { #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[display("coords: {coords}, selection: {selection}, storage: {storage}, units: {units}")] #[serde(rename = "PlyExportOptions")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Options { /// Co-ordinate system of output data. /// @@ -83,6 +84,8 @@ pub mod export { #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr, Default)] #[display(style = "snake_case")] #[serde(rename = "PlyStorage", rename_all = "snake_case")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum Storage { /// Write numbers in their ascii representation (e.g. -13, 6.28, etc.). Properties are separated by spaces and elements are separated by line breaks. #[default] diff --git a/modeling-cmds/src/format/sldprt.rs b/modeling-cmds/src/format/sldprt.rs index 78a0cc0f..8c3f96ba 100644 --- a/modeling-cmds/src/format/sldprt.rs +++ b/modeling-cmds/src/format/sldprt.rs @@ -1,27 +1,16 @@ /// Import functionality. pub mod import { - + use parse_display::{Display, FromStr}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; /// Options for importing SolidWorks parts. - #[derive( - Clone, - Debug, - Default, - Eq, - Hash, - PartialEq, - Serialize, - Deserialize, - JsonSchema, - Display, - FromStr, - - )] + #[derive(Clone, Debug, Default, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[display("split_closed_faces: {split_closed_faces}")] #[serde(default, rename = "SldprtImportOptions")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Options { /// Splits all closed faces into two open faces. /// diff --git a/modeling-cmds/src/format/step.rs b/modeling-cmds/src/format/step.rs index 2c599ade..1f6d61dc 100644 --- a/modeling-cmds/src/format/step.rs +++ b/modeling-cmds/src/format/step.rs @@ -1,4 +1,3 @@ - use parse_display::{Display, FromStr}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -10,21 +9,11 @@ pub mod import { use super::*; /// Options for importing STEP format. - #[derive( - Clone, - Debug, - Default, - Eq, - Hash, - PartialEq, - Serialize, - Deserialize, - JsonSchema, - Display, - FromStr, - )] + #[derive(Clone, Debug, Default, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[display("split_closed_faces: {split_closed_faces}")] #[serde(default, rename = "StepImportOptions")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Options { /// Splits all closed faces into two open faces. /// @@ -40,6 +29,8 @@ pub mod export { /// Options for exporting STEP format. #[derive(Clone, Debug, Deserialize, Eq, Hash, JsonSchema, PartialEq, Serialize)] #[serde(rename = "StepExportOptions")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Options { /// Co-ordinate system of output data. /// diff --git a/modeling-cmds/src/format/stl.rs b/modeling-cmds/src/format/stl.rs index c3631947..ded72edf 100644 --- a/modeling-cmds/src/format/stl.rs +++ b/modeling-cmds/src/format/stl.rs @@ -1,4 +1,3 @@ - use parse_display::{Display, FromStr}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -10,11 +9,11 @@ pub mod import { use super::*; /// Options for importing STL. - #[derive( - Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr, - )] + #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[display("coords: {coords}, units: {units}")] #[serde(rename = "StlImportOptions")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Options { /// Co-ordinate system of input data. /// @@ -47,6 +46,8 @@ pub mod export { #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] #[display("coords: {coords}, selection: {selection}, storage: {storage}, units: {units}")] #[serde(rename = "StlExportOptions")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Options { /// Co-ordinate system of output data. /// @@ -84,6 +85,8 @@ pub mod export { )] #[display(style = "snake_case")] #[serde(rename = "StlStorage", rename_all = "snake_case")] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum Storage { /// Plaintext encoding. Ascii, diff --git a/modeling-cmds/src/id.rs b/modeling-cmds/src/id.rs index 476f82e3..ae8a298b 100644 --- a/modeling-cmds/src/id.rs +++ b/modeling-cmds/src/id.rs @@ -7,6 +7,8 @@ use uuid::Uuid; /// All commands have unique IDs. These should be randomly generated. #[derive(Debug, Clone, Copy, Hash, Ord, PartialOrd, Eq, PartialEq, JsonSchema, Serialize)] #[cfg_attr(test, derive(Default))] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct ModelingCmdId(pub Uuid); impl AsRef for ModelingCmdId { diff --git a/modeling-cmds/src/length_unit.rs b/modeling-cmds/src/length_unit.rs index 2a4fb56d..2fb6213a 100644 --- a/modeling-cmds/src/length_unit.rs +++ b/modeling-cmds/src/length_unit.rs @@ -7,6 +7,8 @@ use crate::shared::{Point2d, Point3d, Point4d}; /// A length unit is wrapper around an f64 that represents a length in some unit. #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize, Default)] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct LengthUnit(pub f64); impl LengthUnit { diff --git a/modeling-cmds/src/ok_response.rs b/modeling-cmds/src/ok_response.rs index d60b65e0..4956333a 100644 --- a/modeling-cmds/src/ok_response.rs +++ b/modeling-cmds/src/ok_response.rs @@ -84,21 +84,6 @@ define_ok_modeling_cmd_response_enum! { pub struct DefaultCameraPerspectiveSettings { } - /// The response from the `EntityMakeHelix` endpoint. - #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] - pub struct EntityMakeHelix { - } - - /// The response from the `EntityMirror` endpoint. - #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] - pub struct EntityMirror { - } - - /// The response from the `EntityMirrorAcrossEdge` endpoint. - #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] - pub struct EntityMirrorAcrossEdge { - } - /// The response from the `SelectAdd` endpoint. #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] pub struct SelectAdd { @@ -442,6 +427,20 @@ define_ok_modeling_cmd_response_enum! { pub entity_ids: Vec, } + /// The response from the `SetObjectTransform` command. + #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] + pub struct SetObjectTransform {} + + /// The response from the `AddHoleFromOffset` command. + #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] + pub struct AddHoleFromOffset { + /// If the offset path splits into multiple paths, this will contain the UUIDs of the + /// new paths. + /// If the offset path remains as a single path, this will be empty, and the resulting ID + /// of the (single) new path will be the ID of the `AddHoleFromOffset` command. + pub entity_ids: Vec, + } + /// The response from the `DefaultCameraFocusOn` command. #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] pub struct DefaultCameraFocusOn { } @@ -747,6 +746,35 @@ define_ok_modeling_cmd_response_enum! { pub entity_ids: Vec, } + /// The response from the `EntityMirror` endpoint. + #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] + pub struct EntityMirror { + /// The UUIDs of the entities that were created. + pub entity_ids: Vec + } + + /// The response from the `EntityMirrorAcrossEdge` endpoint. + #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] + pub struct EntityMirrorAcrossEdge { + /// The UUIDs of the entities that were created. + pub entity_ids: Vec + } + + /// The response from the `EntityMakeHelix` endpoint. + #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] + pub struct EntityMakeHelix { + } + + /// The response from the `EntityMakeHelixFromParams` endpoint. + #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] + pub struct EntityMakeHelixFromParams { + } + + /// The response from the `EntityMakeHelixFromEdge` endpoint. + #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] + pub struct EntityMakeHelixFromEdge { + } + /// Extrusion face info struct (useful for maintaining mappings between source path segment ids and extrusion faces) #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] pub struct Solid3dGetExtrusionFaceInfo { diff --git a/modeling-cmds/src/shared.rs b/modeling-cmds/src/shared.rs index 233268f8..f680568c 100644 --- a/modeling-cmds/src/shared.rs +++ b/modeling-cmds/src/shared.rs @@ -1,19 +1,22 @@ use enum_iterator::Sequence; use parse_display_derive::{Display, FromStr}; -use schemars::JsonSchema; +use schemars::{schema::SchemaObject, JsonSchema}; use serde::{Deserialize, Serialize}; +use uuid::Uuid; #[cfg(feature = "cxx")] use crate::impl_extern_type; -use crate::{length_unit::LengthUnit, units::UnitAngle}; +use crate::{length_unit::LengthUnit, output::ExtrusionFaceInfo, units::UnitAngle}; pub use point::{Point2d, Point3d, Point4d, Quaternion}; mod point; /// What kind of cut to do -#[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, Default)] +#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Default)] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum CutType { /// Round off an edge. #[default] @@ -23,8 +26,10 @@ pub enum CutType { } /// A rotation defined by an axis, origin of rotation, and an angle. -#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Rotation { /// Rotation axis. /// Defaults to (0, 0, 1) (i.e. the Z axis). @@ -48,8 +53,10 @@ impl Default for Rotation { } /// Ways to transform each solid being replicated in a repeating pattern. -#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Transform { /// Translate the replica this far along each dimension. /// Defaults to zero vector (i.e. same position as the original). @@ -80,8 +87,10 @@ impl Default for Transform { } /// Options for annotations -#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct AnnotationOptions { /// Text displayed on the annotation pub text: Option, @@ -96,8 +105,10 @@ pub struct AnnotationOptions { } /// Options for annotation text -#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct AnnotationLineEndOptions { /// How to style the start of the annotation line. pub start: AnnotationLineEnd, @@ -106,8 +117,10 @@ pub struct AnnotationLineEndOptions { } /// Options for annotation text -#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct AnnotationTextOptions { /// Alignment along the X axis pub x: AnnotationTextAlignmentX, @@ -122,8 +135,10 @@ pub struct AnnotationTextOptions { /// The type of distance /// Distances can vary depending on /// the objects used as input. -#[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema)] +#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "snake_case", tag = "type")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum DistanceType { /// Euclidean Distance. Euclidean {}, @@ -135,8 +150,10 @@ pub enum DistanceType { } /// The type of origin -#[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, Default)] +#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Default)] #[serde(rename_all = "snake_case", tag = "type")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum OriginType { /// Local Origin (center of object bounding box). #[default] @@ -151,7 +168,9 @@ pub enum OriginType { } /// An RGBA color -#[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema)] +#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema)] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Color { /// Red pub r: f32, @@ -169,6 +188,8 @@ pub struct Color { Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd, )] #[serde(rename_all = "lowercase")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum AnnotationTextAlignmentX { Left, Center, @@ -181,6 +202,8 @@ pub enum AnnotationTextAlignmentX { Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd, )] #[serde(rename_all = "lowercase")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum AnnotationTextAlignmentY { Bottom, Center, @@ -193,6 +216,8 @@ pub enum AnnotationTextAlignmentY { Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd, )] #[serde(rename_all = "lowercase")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum AnnotationLineEnd { None, Arrow, @@ -203,6 +228,8 @@ pub enum AnnotationLineEnd { Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd, )] #[serde(rename_all = "lowercase")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum AnnotationType { /// 2D annotation type (screen or planar space) T2D, @@ -215,6 +242,8 @@ pub enum AnnotationType { Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd, )] #[serde(rename_all = "lowercase")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum CameraDragInteractionType { /// Camera pan Pan, @@ -230,6 +259,8 @@ pub enum CameraDragInteractionType { /// Paths are composed of many segments. #[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, PartialEq)] #[serde(rename_all = "snake_case", tag = "type")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum PathSegment { /// A straight line segment. /// Goes from the current path "pen" to the given endpoint. @@ -297,6 +328,8 @@ pub enum PathSegment { /// An angle, with a specific unit. #[derive(Clone, Copy, PartialEq, Debug, JsonSchema, Deserialize, Serialize)] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Angle { /// What unit is the measurement? pub unit: UnitAngle, @@ -399,6 +432,8 @@ impl std::ops::AddAssign for Angle { Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd, )] #[serde(rename_all = "lowercase")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum SceneSelectionType { /// Replaces the selection Replace, @@ -414,6 +449,8 @@ pub enum SceneSelectionType { Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd, )] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum SceneToolType { CameraRevolve, Select, @@ -443,6 +480,8 @@ pub enum SceneToolType { Default, )] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum PathComponentConstraintBound { #[default] Unconstrained, @@ -469,6 +508,8 @@ pub enum PathComponentConstraintBound { Default, )] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum PathComponentConstraintType { #[default] Unconstrained, @@ -485,6 +526,8 @@ pub enum PathComponentConstraintType { Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd, )] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum PathCommand { MoveTo, LineTo, @@ -499,6 +542,8 @@ pub enum PathCommand { Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd, )] #[serde(rename_all = "lowercase")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] #[repr(u8)] pub enum EntityType { Entity, @@ -519,6 +564,8 @@ pub enum EntityType { Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd, )] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum CurveType { Line, Arc, @@ -540,6 +587,8 @@ pub struct ExportFile { )] #[serde(rename_all = "lowercase")] #[display(style = "lowercase")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum FileExportFormat { /// Autodesk Filmbox (FBX) format. Fbx, @@ -579,6 +628,8 @@ pub enum FileExportFormat { )] #[serde(rename_all = "lowercase")] #[display(style = "lowercase")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum FileImportFormat { /// Autodesk Filmbox (FBX) format. Fbx, @@ -601,6 +652,8 @@ pub enum FileImportFormat { /// The type of error sent by the KittyCAD graphics engine. #[derive(Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Clone, Ord, PartialOrd)] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum EngineErrorCode { /// User requested something geometrically or graphically impossible. /// Don't retry this request, as it's inherently impossible. Instead, read the error message @@ -619,8 +672,37 @@ impl From for http::StatusCode { } } +/// IDs for the extruded faces. +#[derive(Debug, PartialEq, Serialize, Deserialize, JsonSchema, Clone)] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] +pub struct ExtrudedFaceInfo { + /// The face made from the original 2D shape being extruded. + /// If the solid is extruded from a shape which already has an ID + /// (e.g. extruding something which was sketched on a face), this + /// doesn't need to be sent. + pub bottom: Option, + /// Top face of the extrusion (parallel and further away from the original 2D shape being extruded). + pub top: Uuid, + /// Any intermediate sides between the top and bottom. + pub sides: Vec, +} + +/// IDs for a side face, extruded from the path of some sketch/2D shape. +#[derive(Debug, PartialEq, Serialize, Deserialize, JsonSchema, Clone)] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] +pub struct SideFace { + /// ID of the path this face is being extruded from. + pub path_id: Uuid, + /// Desired ID for the resulting face. + pub face_id: Uuid, +} + /// Camera settings including position, center, fov etc #[derive(Debug, Serialize, Deserialize, JsonSchema, Clone)] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct CameraSettings { ///Camera position (vantage) pub pos: Point3d, @@ -683,6 +765,8 @@ impl From for crate::output::ViewIsometric { /// Defines a perspective view. #[derive(Copy, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Clone, PartialOrd, Default)] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct PerspectiveCameraParameters { /// Camera frustum vertical field of view. pub fov_y: Option, @@ -710,6 +794,8 @@ pub struct PerspectiveCameraParameters { PartialOrd, )] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum CameraMovement { /// Adjusts the camera position during the camera operation #[default] @@ -723,6 +809,8 @@ pub enum CameraMovement { Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd, )] #[serde(rename_all = "lowercase")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum GlobalAxis { /// The X axis X, @@ -737,6 +825,8 @@ pub enum GlobalAxis { Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd, )] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] #[repr(u8)] pub enum ExtrusionFaceCapType { /// Uncapped. @@ -768,6 +858,8 @@ pub enum ExtrusionFaceCapType { Default, )] #[serde(rename_all = "lowercase")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum PostEffectType { Phosphor, Ssao, @@ -820,6 +912,35 @@ fn z_axis() -> Point3d { Point3d { x: 0.0, y: 0.0, z: 1.0 } } +impl ExtrudedFaceInfo { + /// Converts from the representation used in the Extrude modeling command, + /// to a flat representation. + pub fn list_faces(self) -> Vec { + let mut face_infos: Vec<_> = self + .sides + .into_iter() + .map(|side| ExtrusionFaceInfo { + curve_id: Some(side.path_id), + face_id: Some(side.face_id), + cap: ExtrusionFaceCapType::None, + }) + .collect(); + face_infos.push(ExtrusionFaceInfo { + curve_id: None, + face_id: Some(self.top), + cap: ExtrusionFaceCapType::Top, + }); + if let Some(bottom) = self.bottom { + face_infos.push(ExtrusionFaceInfo { + curve_id: None, + face_id: Some(bottom), + cap: ExtrusionFaceCapType::Bottom, + }); + } + face_infos + } +} + #[cfg(test)] mod tests { use super::*; @@ -848,3 +969,56 @@ mod tests { assert!(c >= a); } } + +/// How a property of an object should be transformed. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] +pub struct TransformBy { + /// The scale, or rotation, or translation. + pub property: T, + /// If true, overwrite the previous value with this. + /// If false, the previous value will be modified. + /// E.g. when translating, `set=true` will set a new location, + /// and `set=false` will translate the current location by the given X/Y/Z. + pub set: bool, + /// If true, the transform is applied in local space. + /// If false, the transform is applied in global space. + pub is_local: bool, +} + +impl JsonSchema for TransformBy { + fn schema_name() -> String { + format!("TransformByFor{}", T::schema_name()) + } + + fn schema_id() -> std::borrow::Cow<'static, str> { + std::borrow::Cow::Owned(format!("{}::TransformBy<{}>", module_path!(), T::schema_id())) + } + + fn json_schema(_: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { + SchemaObject { + instance_type: Some(schemars::schema::InstanceType::String.into()), + ..Default::default() + } + .into() + } +} + +/// Container that holds a translate, rotate and scale. +#[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize)] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] +pub struct ComponentTransform { + /// Translate component of the transform. + pub translate: Option>>, + /// Rotate component of the transform. + /// The rotation is specified as a roll, pitch, yaw. + pub rotate_rpy: Option>>, + /// Rotate component of the transform. + /// The rotation is specified as an axis and an angle (xyz are the components of the axis, w is + /// the angle in degrees). + pub rotate_angle_axis: Option>>, + /// Scale component of the transform. + pub scale: Option>>, +} diff --git a/modeling-cmds/src/shared/point.rs b/modeling-cmds/src/shared/point.rs index b6b23f51..b9b475d1 100644 --- a/modeling-cmds/src/shared/point.rs +++ b/modeling-cmds/src/shared/point.rs @@ -10,6 +10,8 @@ mod zero; #[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, Default)] #[serde(rename = "Point2d")] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Point2d { #[allow(missing_docs)] pub x: T, @@ -56,6 +58,8 @@ impl Point2d { #[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, PartialEq, Default)] #[serde(rename = "Point3d")] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Point3d { #[allow(missing_docs)] pub x: T, @@ -113,6 +117,8 @@ impl Point3d { #[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema)] #[serde(rename = "Point4d")] #[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub struct Point4d { #[allow(missing_docs)] pub x: T, diff --git a/modeling-cmds/src/units.rs b/modeling-cmds/src/units.rs index a63acd24..47b3ef13 100644 --- a/modeling-cmds/src/units.rs +++ b/modeling-cmds/src/units.rs @@ -23,6 +23,8 @@ use serde::{Deserialize, Serialize}; )] #[cfg_attr(feature = "tabled", derive(tabled::Tabled))] #[display(style = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum UnitLength { /// Centimeters #[serde(rename = "cm")] @@ -84,6 +86,8 @@ impl UnitLength { #[cfg_attr(feature = "tabled", derive(tabled::Tabled))] #[serde(rename_all = "snake_case")] #[display(style = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum UnitAngle { /// Degrees Degrees, @@ -112,6 +116,8 @@ pub enum UnitAngle { #[cfg_attr(feature = "tabled", derive(tabled::Tabled))] #[serde(rename_all = "snake_case")] #[display(style = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum UnitArea { /// Square centimeters #[serde(rename = "cm2")] @@ -184,6 +190,8 @@ impl UnitArea { )] #[cfg_attr(feature = "tabled", derive(tabled::Tabled))] #[display(style = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum UnitDensity { /// Pounds per cubic feet. #[serde(rename = "lb:ft3")] @@ -228,6 +236,8 @@ impl UnitDensity { #[cfg_attr(feature = "tabled", derive(tabled::Tabled))] #[serde(rename_all = "snake_case")] #[display(style = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum UnitMass { /// Grams #[default] @@ -275,6 +285,8 @@ impl UnitMass { )] #[cfg_attr(feature = "tabled", derive(tabled::Tabled))] #[display(style = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] pub enum UnitVolume { /// Cubic centimeters (cc or cm³) #[serde(rename = "cm3")] diff --git a/modeling-session/Cargo.toml b/modeling-session/Cargo.toml index 54d24355..dd4c09ff 100644 --- a/modeling-session/Cargo.toml +++ b/modeling-session/Cargo.toml @@ -15,12 +15,12 @@ futures = "0.3.31" kittycad = { workspace = true } kittycad-modeling-cmds = { workspace = true, features = ["websocket"] } lsystem = "0.2.1" -reqwest = "0.12.9" -serde_json = "1.0.133" -thiserror = "2.0.6" +reqwest = "0.12.12" +serde_json = "1.0.135" +thiserror = "2.0.11" tokio = { version = "1", features = ["sync"] } tokio-tungstenite = "0.24.0" -uuid = { version = "1.11.0", features = ["v4"] } +uuid = { version = "1.12.0", features = ["v4"] } [dev-dependencies] color-eyre = "0.6" diff --git a/modeling-session/examples/cube_png.rs b/modeling-session/examples/cube_png.rs index 491afcf1..625de92d 100644 --- a/modeling-session/examples/cube_png.rs +++ b/modeling-session/examples/cube_png.rs @@ -44,7 +44,7 @@ async fn main() -> Result<()> { let path_id = Uuid::new_v4(); let path = path_id.into(); session - .run_command(path, ModelingCmd::StartPath(StartPath {})) + .run_command(path, ModelingCmd::StartPath(StartPath::default())) .await .context("could not create path")?; @@ -107,6 +107,7 @@ async fn main() -> Result<()> { Extrude { distance: CUBE_WIDTH * 2.0, target: path, + faces: None, } .into(), ) diff --git a/modeling-session/examples/cube_png_batch.rs b/modeling-session/examples/cube_png_batch.rs index d66c4042..210459b8 100644 --- a/modeling-session/examples/cube_png_batch.rs +++ b/modeling-session/examples/cube_png_batch.rs @@ -45,7 +45,7 @@ async fn main() -> Result<()> { let path_id = Uuid::new_v4(); let path = path_id.into(); session - .run_command(path, StartPath {}.into()) + .run_command(path, StartPath::default().into()) .await .context("could not create path")?; @@ -98,6 +98,7 @@ async fn main() -> Result<()> { cmd: ModelingCmd::Extrude(Extrude { distance: CUBE_WIDTH * 2.0, target: path, + faces: None, }), cmd_id: random_id(), }); diff --git a/modeling-session/examples/lsystem_png_batch.rs b/modeling-session/examples/lsystem_png_batch.rs index 6ca286aa..842ee4cc 100644 --- a/modeling-session/examples/lsystem_png_batch.rs +++ b/modeling-session/examples/lsystem_png_batch.rs @@ -52,7 +52,7 @@ async fn main() -> Result<()> { let path_id = Uuid::new_v4(); let path = path_id.into(); session - .run_command(path, ModelingCmd::from(StartPath {})) + .run_command(path, ModelingCmd::from(StartPath::default())) .await .context("could not create path")?; @@ -137,6 +137,7 @@ async fn main() -> Result<()> { cmd: ModelingCmd::Extrude(Extrude { distance: LengthUnit(1.0), target: path, + faces: None, }), cmd_id: random_id(), });