space_ex v0.3.0 SpaceEx.SpaceCenter.Part

Represents an individual part.

Vessels are made up of multiple parts. Instances of this class can be obtained by several methods in SpaceEx.SpaceCenter.Parts.

Link to this section Summary

Functions

Exert a constant force on the part, acting at the given position

A SpaceEx.SpaceCenter.Antenna if the part is an antenna, otherwise nil

Whether the part is axially attached to its parent, i.e

The axis-aligned bounding box of the part in the given reference frame

A SpaceEx.SpaceCenter.CargoBay if the part is a cargo bay, otherwise nil

The position of the parts center of mass in the given reference frame

The reference frame that is fixed relative to this part, and centered on its center of mass

The parts children

A SpaceEx.SpaceCenter.ControlSurface if the part is an aerodynamic control surface, otherwise nil

The cost of the part, in units of funds

Whether this part is crossfeed capable

The stage in which this part will be decoupled

A SpaceEx.SpaceCenter.Decoupler if the part is a decoupler, otherwise nil

The direction the part points in, in the given reference frame

A SpaceEx.SpaceCenter.DockingPort if the part is a docking port, otherwise nil

The mass of the part, not including any resources it contains, in kilograms

The dynamic pressure acting on the part, in Pascals

An SpaceEx.SpaceCenter.Engine if the part is an engine, otherwise nil

An SpaceEx.SpaceCenter.Experiment if the part is a science experiment, otherwise nil

A SpaceEx.SpaceCenter.Fairing if the part is a fairing, otherwise nil

The parts that are connected to this part via fuel lines, where the direction of the fuel line is into this part

The parts that are connected to this part via fuel lines, where the direction of the fuel line is out of this part

The color used to highlight the part, as an RGB triple

Whether the part is highlighted

The impact tolerance of the part, in meters per second

The inertia tensor of the part in the parts reference frame (SpaceEx.SpaceCenter.ReferenceFrame)

Exert an instantaneous force on the part, acting at the given position

An SpaceEx.SpaceCenter.Intake if the part is an intake, otherwise nil

Whether this part is a fuel line

A SpaceEx.SpaceCenter.LaunchClamp if the part is a launch clamp, otherwise nil

A SpaceEx.SpaceCenter.Leg if the part is a landing leg, otherwise nil

A SpaceEx.SpaceCenter.Light if the part is a light, otherwise nil

The current mass of the part, including resources it contains, in kilograms

Whether the part is massless

Maximum temperature that the skin of the part can survive, in Kelvin

Maximum temperature that the part can survive, in Kelvin

The modules for this part

The moment of inertia of the part in \(kg.m^2\) around its center of mass in the parts reference frame (SpaceEx.SpaceCenter.ReferenceFrame)

Internal name of the part, as used in part cfg files

A SpaceEx.SpaceCenter.Parachute if the part is a parachute, otherwise nil

The parts parent

The position of the part in the given reference frame

Whether the part is radially attached to its parent, i.e

A SpaceEx.SpaceCenter.Radiator if the part is a radiator, otherwise nil

A SpaceEx.SpaceCenter.RCS if the part is an RCS block/thruster, otherwise nil

A SpaceEx.SpaceCenter.ReactionWheel if the part is a reaction wheel, otherwise nil

The reference frame that is fixed relative to this part, and centered on a fixed position within the part, defined by the parts model

A SpaceEx.SpaceCenter.ResourceConverter if the part is a resource converter, otherwise nil

A SpaceEx.SpaceCenter.ResourceHarvester if the part is a resource harvester, otherwise nil

The rotation of the part, in the given reference frame

A SpaceEx.SpaceCenter.Sensor if the part is a sensor, otherwise nil

The color used to highlight the part, as an RGB triple

Whether the part is highlighted

The name tag for the part

Whether the part is shielded from the exterior of the vessel, for example by a fairing

Temperature of the skin of the part, in Kelvin

A SpaceEx.SpaceCenter.SolarPanel if the part is a solar panel, otherwise nil

The stage in which this part will be activated

The name tag for the part

Temperature of the part, in Kelvin

The rate at which heat energy is conducting into or out of the part via contact with other parts

The rate at which heat energy is convecting into or out of the part from the surrounding atmosphere

The rate at which heat energy is begin generated by the part

A measure of how much energy it takes to increase the internal temperature of the part, in Joules per Kelvin

The rate at which heat energy is radiating into or out of the part from the surrounding environment

A measure of how much energy it takes to increase the temperature of the resources contained in the part, in Joules per Kelvin

A measure of how much energy it takes to increase the skin temperature of the part, in Joules per Kelvin

The rate at which heat energy is transferring between the part's skin and its internals

Title of the part, as shown when the part is right clicked in-game

The linear velocity of the part in the given reference frame

The vessel that contains this part

A SpaceEx.SpaceCenter.Wheel if the part is a wheel, otherwise nil

Link to this section Functions

Link to this function add_force(conn, this, force, position, referenceFrame)

Exert a constant force on the part, acting at the given position.

Returns: An object that can be used to remove or modify the force.

  • force — A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons.

  • position — The position at which the force acts, as a vector.

  • referenceFrame — The reference frame that the force and position are in.

Link to this function antenna(conn, this)

A SpaceEx.SpaceCenter.Antenna if the part is an antenna, otherwise nil.

Link to this function axially_attached(conn, this)

Whether the part is axially attached to its parent, i.e.

on the top or bottom of its parent. If the part has no parent, returns false.

Link to this function bounding_box(conn, this, referenceFrame)

The axis-aligned bounding box of the part in the given reference frame.

Returns: The positions of the minimum and maximum vertices of the box, as position vectors.

  • referenceFrame — The reference frame that the returned position vectors are in.

This is computed from the collision mesh of the part. If the part is not collidable, the box has zero volume and is centered on the SpaceEx.SpaceCenter.Part.position/3 of the part.

Link to this function cargo_bay(conn, this)

A SpaceEx.SpaceCenter.CargoBay if the part is a cargo bay, otherwise nil.

Link to this function center_of_mass(conn, this, referenceFrame)

The position of the parts center of mass in the given reference frame.

If the part is physicsless, this is equivalent to SpaceEx.SpaceCenter.Part.position/3.

Returns: The position as a vector.

  • referenceFrame — The reference frame that the returned position vector is in.
Link to this function center_of_mass_reference_frame(conn, this)

The reference frame that is fixed relative to this part, and centered on its center of mass.

For docking port parts, this reference frame is not necessarily equivalent to the reference frame for the docking port, returned by SpaceEx.SpaceCenter.DockingPort.reference_frame/2.

Link to this function children(conn, this)

The parts children.

Returns an empty list if the part has no children. This, in combination with SpaceEx.SpaceCenter.Part.parent/2, can be used to traverse the vessels parts tree.

Link to this function control_surface(conn, this)

A SpaceEx.SpaceCenter.ControlSurface if the part is an aerodynamic control surface, otherwise nil.

Link to this function cost(conn, this)

The cost of the part, in units of funds.

Link to this function crossfeed(conn, this)

Whether this part is crossfeed capable.

Link to this function decouple_stage(conn, this)

The stage in which this part will be decoupled.

Returns -1 if the part is never decoupled from the vessel.

Link to this function decoupler(conn, this)

A SpaceEx.SpaceCenter.Decoupler if the part is a decoupler, otherwise nil.

Link to this function direction(conn, this, referenceFrame)

The direction the part points in, in the given reference frame.

Returns: The direction as a unit vector.

  • referenceFrame — The reference frame that the returned direction is in.
Link to this function docking_port(conn, this)

A SpaceEx.SpaceCenter.DockingPort if the part is a docking port, otherwise nil.

Link to this function dry_mass(conn, this)

The mass of the part, not including any resources it contains, in kilograms.

Returns zero if the part is massless.

Link to this function dynamic_pressure(conn, this)

The dynamic pressure acting on the part, in Pascals.

Link to this function engine(conn, this)

An SpaceEx.SpaceCenter.Engine if the part is an engine, otherwise nil.

Link to this function experiment(conn, this)

An SpaceEx.SpaceCenter.Experiment if the part is a science experiment, otherwise nil.

Link to this function fairing(conn, this)

A SpaceEx.SpaceCenter.Fairing if the part is a fairing, otherwise nil.

Link to this function fuel_lines_from(conn, this)

The parts that are connected to this part via fuel lines, where the direction of the fuel line is into this part.

Link to this function fuel_lines_to(conn, this)

The parts that are connected to this part via fuel lines, where the direction of the fuel line is out of this part.

Link to this function highlight_color(conn, this)

The color used to highlight the part, as an RGB triple.

Link to this function highlighted(conn, this)

Whether the part is highlighted.

Link to this function impact_tolerance(conn, this)

The impact tolerance of the part, in meters per second.

Link to this function inertia_tensor(conn, this)

The inertia tensor of the part in the parts reference frame (SpaceEx.SpaceCenter.ReferenceFrame).

Returns the 3x3 matrix as a list of elements, in row-major order.

Link to this function instantaneous_force(conn, this, force, position, referenceFrame)

Exert an instantaneous force on the part, acting at the given position.

  • force — A vector pointing in the direction that the force acts, with its magnitude equal to the strength of the force in Newtons.

  • position — The position at which the force acts, as a vector.

  • referenceFrame — The reference frame that the force and position are in. The force is applied instantaneously in a single physics update.

Link to this function intake(conn, this)

An SpaceEx.SpaceCenter.Intake if the part is an intake, otherwise nil.

This includes any part that generates thrust. This covers many different types of engine, including liquid fuel rockets, solid rocket boosters and jet engines. For RCS thrusters see SpaceEx.SpaceCenter.RCS.

Link to this function is_fuel_line(conn, this)

Whether this part is a fuel line.

Link to this function launch_clamp(conn, this)

A SpaceEx.SpaceCenter.LaunchClamp if the part is a launch clamp, otherwise nil.

Link to this function leg(conn, this)

A SpaceEx.SpaceCenter.Leg if the part is a landing leg, otherwise nil.

Link to this function light(conn, this)

A SpaceEx.SpaceCenter.Light if the part is a light, otherwise nil.

Link to this function mass(conn, this)

The current mass of the part, including resources it contains, in kilograms.

Returns zero if the part is massless.

Link to this function massless(conn, this)

Whether the part is massless.

Link to this function max_skin_temperature(conn, this)

Maximum temperature that the skin of the part can survive, in Kelvin.

Link to this function max_temperature(conn, this)

Maximum temperature that the part can survive, in Kelvin.

Link to this function modules(conn, this)

The modules for this part.

Link to this function moment_of_inertia(conn, this)

The moment of inertia of the part in \(kg.m^2\) around its center of mass in the parts reference frame (SpaceEx.SpaceCenter.ReferenceFrame).

Link to this function name(conn, this)

Internal name of the part, as used in part cfg files.

For example "Mark1-2Pod".

Link to this function parachute(conn, this)

A SpaceEx.SpaceCenter.Parachute if the part is a parachute, otherwise nil.

Link to this function parent(conn, this)

The parts parent.

Returns nil if the part does not have a parent. This, in combination with SpaceEx.SpaceCenter.Part.children/2, can be used to traverse the vessels parts tree.

Link to this function position(conn, this, referenceFrame)

The position of the part in the given reference frame.

Returns: The position as a vector.

  • referenceFrame — The reference frame that the returned position vector is in.

This is a fixed position in the part, defined by the parts model. It s not necessarily the same as the parts center of mass. Use SpaceEx.SpaceCenter.Part.center_of_mass/3 to get the parts center of mass.

Link to this function radially_attached(conn, this)

Whether the part is radially attached to its parent, i.e.

on the side of its parent. If the part has no parent, returns false.

Link to this function radiator(conn, this)

A SpaceEx.SpaceCenter.Radiator if the part is a radiator, otherwise nil.

Link to this function rcs(conn, this)

A SpaceEx.SpaceCenter.RCS if the part is an RCS block/thruster, otherwise nil.

Link to this function reaction_wheel(conn, this)

A SpaceEx.SpaceCenter.ReactionWheel if the part is a reaction wheel, otherwise nil.

Link to this function reference_frame(conn, this)

The reference frame that is fixed relative to this part, and centered on a fixed position within the part, defined by the parts model.

  • The origin is at the position of the part, as returned by SpaceEx.SpaceCenter.Part.position/3.

  • The axes rotate with the part.

  • The x, y and z axis directions depend on the design of the part.

For docking port parts, this reference frame is not necessarily equivalent to the reference frame for the docking port, returned by SpaceEx.SpaceCenter.DockingPort.reference_frame/2.

Link to this function resource_converter(conn, this)

A SpaceEx.SpaceCenter.ResourceConverter if the part is a resource converter, otherwise nil.

Link to this function resource_harvester(conn, this)

A SpaceEx.SpaceCenter.ResourceHarvester if the part is a resource harvester, otherwise nil.

Link to this function resources(conn, this)

A SpaceEx.SpaceCenter.Resources object for the part.

Link to this function rotation(conn, this, referenceFrame)

The rotation of the part, in the given reference frame.

Returns: The rotation as a quaternion of the form \((x, y, z, w)\).

  • referenceFrame — The reference frame that the returned rotation is in.
Link to this function sensor(conn, this)

A SpaceEx.SpaceCenter.Sensor if the part is a sensor, otherwise nil.

Link to this function set_highlight_color(conn, this, value)

The color used to highlight the part, as an RGB triple.

Link to this function set_highlighted(conn, this, value)

Whether the part is highlighted.

Link to this function set_tag(conn, this, value)

The name tag for the part.

Can be set to a custom string using the in-game user interface.

This requires either the NameTag or kOS mod to be installed.

Link to this function shielded(conn, this)

Whether the part is shielded from the exterior of the vessel, for example by a fairing.

Link to this function skin_temperature(conn, this)

Temperature of the skin of the part, in Kelvin.

Link to this function solar_panel(conn, this)

A SpaceEx.SpaceCenter.SolarPanel if the part is a solar panel, otherwise nil.

Link to this function stage(conn, this)

The stage in which this part will be activated.

Returns -1 if the part is not activated by staging.

Link to this function tag(conn, this)

The name tag for the part.

Can be set to a custom string using the in-game user interface.

This requires either the NameTag or kOS mod to be installed.

Link to this function temperature(conn, this)

Temperature of the part, in Kelvin.

Link to this function thermal_conduction_flux(conn, this)

The rate at which heat energy is conducting into or out of the part via contact with other parts.

Measured in energy per unit time, or power, in Watts. A positive value means the part is gaining heat energy, and negative means it is losing heat energy.

Link to this function thermal_convection_flux(conn, this)

The rate at which heat energy is convecting into or out of the part from the surrounding atmosphere.

Measured in energy per unit time, or power, in Watts. A positive value means the part is gaining heat energy, and negative means it is losing heat energy.

Link to this function thermal_internal_flux(conn, this)

The rate at which heat energy is begin generated by the part.

For example, some engines generate heat by combusting fuel. Measured in energy per unit time, or power, in Watts. A positive value means the part is gaining heat energy, and negative means it is losing heat energy.

Link to this function thermal_mass(conn, this)

A measure of how much energy it takes to increase the internal temperature of the part, in Joules per Kelvin.

Link to this function thermal_radiation_flux(conn, this)

The rate at which heat energy is radiating into or out of the part from the surrounding environment.

Measured in energy per unit time, or power, in Watts. A positive value means the part is gaining heat energy, and negative means it is losing heat energy.

Link to this function thermal_resource_mass(conn, this)

A measure of how much energy it takes to increase the temperature of the resources contained in the part, in Joules per Kelvin.

Link to this function thermal_skin_mass(conn, this)

A measure of how much energy it takes to increase the skin temperature of the part, in Joules per Kelvin.

Link to this function thermal_skin_to_internal_flux(conn, this)

The rate at which heat energy is transferring between the part's skin and its internals.

Measured in energy per unit time, or power, in Watts. A positive value means the part's internals are gaining heat energy, and negative means its skin is gaining heat energy.

Link to this function title(conn, this)

Title of the part, as shown when the part is right clicked in-game.

For example "Mk1-2 Command Pod".

Link to this function velocity(conn, this, referenceFrame)

The linear velocity of the part in the given reference frame.

Returns: The velocity as a vector. The vector points in the direction of travel, and its magnitude is the speed of the body in meters per second.

  • referenceFrame — The reference frame that the returned velocity vector is in.
Link to this function vessel(conn, this)

The vessel that contains this part.

Link to this function wheel(conn, this)

A SpaceEx.SpaceCenter.Wheel if the part is a wheel, otherwise nil.