Expand description
Reading OpenRocket .ork design files.
Guide: OpenRocket .ork design files says what this reads and what it leaves out.
A .ork is a design: a tree of components, the materials they are made of, the motors flown in
them, and the simulations OpenRocket last ran. This module is the first step of reading one:
getting the design document out of whichever container it arrived in, and into a tree that
keeps everything the file said. rocket turns that tree into hpr_design types: the spine,
which is the stages and the body components stacked in them (component), and the parts on
and inside each of those (attached).
Nothing here reads a file: hpr-io does no I/O and builds for wasm32-unknown-unknown, so the
caller supplies the bytes.
let xml = br#"<?xml version="1.0" encoding="UTF-8"?>
<openrocket version="1.10" creator="OpenRocket 24.12">
<rocket><name>Sounder</name></rocket>
</openrocket>"#;
let read = hpr_io::ork::read(xml)?;
assert_eq!(read.value.container, hpr_io::ork::Container::Xml);
assert_eq!(read.value.document.version.to_string(), "1.10");
let rocket = read.value.document.root.child("rocket").expect("a rocket");
assert_eq!(rocket.child("name").expect("a name").text(), "Sounder");
assert!(read.warnings.is_empty());Re-exports§
pub use attached::ATTACHED_TAGS;pub use component::OPENROCKET_DEFAULT_RADIUS_M;pub use component::rocket;pub use container::Attachment;pub use container::Container;pub use container::MAX_UNPACKED_BYTES;pub use container::Unpacked;pub use document::Document;pub use document::Element;pub use document::MAX_DEPTH;pub use document::MAX_KNOWN_MINOR;pub use document::Node;pub use document::SchemaVersion;pub use extensions::Extensions;pub use extensions::Kept;pub use extensions::KeptAttribute;pub use extensions::OpenRocketExtension;pub use extensions::element_at;pub use motors::CaseSize;pub use motors::Curve;pub use motors::Ignition;pub use motors::IgnitionEvent;pub use motors::LeftOut;pub use motors::MotorConfiguration;pub use motors::Motors;pub use motors::NoCurve;pub use motors::NotFlown;pub use motors::OrkMotor;pub use motors::SuppliedCurves;pub use motors::UnreadMotor;pub use recovery::DeployEvent;pub use recovery::Deployment;pub use recovery::DeviceKind;pub use recovery::EventSetting;pub use recovery::Recovery;pub use recovery::RecoveryDevice;pub use recovery::Separation;pub use recovery::SeparationEvent;pub use recovery::StageSeparation;pub use recovery::UnreadDevice;pub use simulations::Atmosphere;pub use simulations::LaunchConditions;pub use simulations::OPENROCKET_CALCULATOR;pub use simulations::OPENROCKET_SIMULATOR;pub use simulations::StoredBranch;pub use simulations::StoredEvent;pub use simulations::StoredReferenceExclusion;pub use simulations::StoredResults;pub use simulations::StoredSimulation;pub use simulations::WindLevel;pub use staging::Staging;pub use staging::StagingTrigger;pub use value::AXIAL_OFFSET;pub use value::Dimension;pub use value::INSTANCE_COUNT;pub use value::Overrides;pub use value::Values;
Modules§
- attached
- The parts on and inside the body: what hangs off a
.orkdesign’s spine. - component
- The spine of a design: its stages and the body components stacked inside them.
- container
- The three packages a
.orkfile arrives in, told apart by their first bytes. - document
- The design document: the XML tree inside a
.ork, kept whole. - export
- Writing a design back out as an OpenRocket
.orkfile. - extensions
- What a
.orkdesign holds that hpr’s design does not model, kept whole for an export to put back: thex-openrocketextension. - motors
- The motors a
.orkdesign flies: its motor configurations, the motor each mount holds in each of them, when that motor ignites, its ejection delay, and the thrust curve it flies on. - recovery
- When a
.orkdesign’s parachutes and streamers open, how much drag each states, and when each stage separates. - simulations
- The simulations OpenRocket last ran on a
.orkdesign: the launch conditions each was flown in and the results it stored. - staging
- When a
.orkdesign’s motors light and where its stack comes apart, in the terms hpr’s flight takes (M1.9c, decision ADR-076). - value
- Reading the values a
.orkwrites inside its elements.
Structs§
- Design
- A
.orkdesign read whole: its rocket, carrying every motor configuration hpr can fly as written, and everything the file says about its motors. - Imported
- A value read from a
.orkfile and the warnings its reader raised, in the order they arose. - OrkFile
- A
.orkfile, read: the container it came in, its design document, and everything else it carried. - Warning
- Something the reader accepted and flagged, rather than failing over.
Enums§
- OrkError
- A
.orkfile that could not be opened or whose design document could not be parsed. - Warning
Kind - How serious a
Warningis.
Functions§
- airframe_
not_ as_ written - Why the rocket in
filewas not read exactly as written, orNoneif it was. A rocket read otherwise flies in none of its configurations, whatever its motors (ADR-055, the rule for which configurations fly), so a program that puts a motor of its own into a configurationdesignleft out, ashpr sim --motordoes, asks this first: a configuration’sLeftOutnames only the first reason onNotFlown’s list, and a missing curve comes before the airframe. - design
- Reads the design in a
.orkfile: the rocket (rocket) and its motors (motors), with thrust curves from the archive’sthrustcurves/*.rseentries or the bundled catalog. - design_
with - Like
design, but a motor can also take its thrust curve fromsupplied. - read
- Reads a
.orkfile from its bytes: sniffs the container, unpacks it, and parses the design.