mod geometry;
mod import;
mod reader;
mod schema;
mod to_step;
pub use import::{import_parasolid, import_parasolid_bytes_report, import_parasolid_report, ParasolidImportReport};
pub use reader::{parse_xt, parse_xt_text, Node, NodeLayout, Value, XtFile};
pub use schema::{Count as XtFieldCount, FieldDef as XtFieldDef, Kind as XtFieldKind};
pub fn is_xt_text(text: &str) -> bool {
let start = text.trim_start_matches(['\u{feff}', ' ', '\t', '\r', '\n']);
if start.starts_with("**ABCDEFGHIJKLMNOPQRSTUVWXYZ") {
return start.lines().nth(1).is_some_and(|line| line.starts_with("**PARASOLID"));
}
let Some(rest) = start.strip_prefix('T') else { return false };
let digits = rest.bytes().take_while(u8::is_ascii_digit).count();
digits > 0 && rest[digits..].trim_start().starts_with(": TRANSMIT FILE")
}
pub fn is_xt_binary(bytes: &[u8]) -> bool {
let body = match bytes.windows(15).position(|w| w == b"**END_OF_HEADER") {
Some(end) if bytes.starts_with(b"**ABCDEFGHIJKLMNOPQRSTUVWXYZ") => {
match bytes[end..].iter().position(|&b| b == b'\n') {
Some(n) => &bytes[end + n + 1..],
None => return false,
}
}
_ => bytes,
};
matches!(body, [b'P', b'S', 0, 0 | 1, ..])
}