Skip to main content

Module ork

Module ork 

Source
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 .ork design’s spine.
component
The spine of a design: its stages and the body components stacked inside them.
container
The three packages a .ork file 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 .ork file.
extensions
What a .ork design holds that hpr’s design does not model, kept whole for an export to put back: the x-openrocket extension.
motors
The motors a .ork design 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 .ork design’s parachutes and streamers open, how much drag each states, and when each stage separates.
simulations
The simulations OpenRocket last ran on a .ork design: the launch conditions each was flown in and the results it stored.
staging
When a .ork design’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 .ork writes inside its elements.

Structs§

Design
A .ork design 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 .ork file and the warnings its reader raised, in the order they arose.
OrkFile
A .ork file, 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 .ork file that could not be opened or whose design document could not be parsed.
WarningKind
How serious a Warning is.

Functions§

airframe_not_as_written
Why the rocket in file was not read exactly as written, or None if 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 configuration design left out, as hpr sim --motor does, asks this first: a configuration’s LeftOut names only the first reason on NotFlown’s list, and a missing curve comes before the airframe.
design
Reads the design in a .ork file: the rocket (rocket) and its motors (motors), with thrust curves from the archive’s thrustcurves/*.rse entries or the bundled catalog.
design_with
Like design, but a motor can also take its thrust curve from supplied.
read
Reads a .ork file from its bytes: sniffs the container, unpacks it, and parses the design.