Top  Previous  Next


The Assignment statement, represented by an equals (=) sign, sets the object or property on the left-hand side of the equals sign to the value specified on the right-hand side of the equals sign. This statement can be used to set the properties of one Spacecraft equal to those of another Spacecraft (the Name property is not assigned in order to keep the names of each object unique). For more information, see the Matrix, Array, and Variable Math Script Reference.


You can assign the following object types:

Simulation Objects





Variable Types























// Assign two Spacecraft or two GroundStations

mySpacecraft2 = mySpacecraft1;
myGroundStation2 = myGroundStation1;

// Assign properties of a Spacecraft
mySpacecraft1.Name = "mySC";
mySpacecraft1.A = 8000;
mySpacecraft2.A = mySpacecraft1.A;
mySpacecraft1.Tanks[0].TankMass = 100;

// Assign a value to a Variable object
myVariable = 12;
myVariable2 = myVariable1 + myArray[0];
myVariable3 = myVariable1*myVariable2;

// Assign an Array or elements from an Array
myArray3 = myArray1 + myArray2;

myArray2 = {0, 1, 2, 3, 4, 5};

myArray2 = mySpacecraft.Position; // This will reduce the Dimension of the Array so that it only has 3 elements
myArray1[0] = 5;
myArray2[0] = myArray1[0] - myArray1[1];

// Assign a value to a String object
myString = "myText";
myString2 = myStringArray[0];

// Assign a StringArray or elements from a StringArray
myStringArray2 = myStringArray1;
myStringArray[1] = myStringArray[0];

myStringArray = {"a", "b", "c"};


// If you set the value of an integer property to a fractional number, FreeFlyer will truncate the fractional part, as seen in the example below:

Array a;

a.Dimension = 5.67; // This sets the dimension to 5


// Assign plot-related objects

PlotWindow2.PlotTitle = PlotWindow1.PlotTitle;

PlotWindow2.XAxis = PlotWindow1.XAxis;

PlotWindow2.YAxis = PlotWindow1.YAxis;

PlotWindow2.Legend = PlotWindow1.Legend;




The "equivalent" condition (==) can not be used in place of assignment (=).

FreeFlyer also supports a reference assignment operator (:=) as well as increment/decrement operators (e.g. +=). See the Script Operators page for more information.

oThe Object.ReferenceEquals() method can be used to check whether one object refers to another.


Any writable object property can be assigned a value.

oConstant Variables and Strings can not be assigned, because their values can not be changed after they are created.


Assigning Spacecraft or GroundStation objects to other objects of the same type will equalize the objects' properties, but not the properties of any attached objects or subsystems (such as Propagators, ForceModels, Tanks, Thrusters, Sensors, and Antennas).

oOne way to copy objects or subsystems that are not supported by the Assignment command is to use the Put and Get commands to put the first object out to a file and then load all the properties back in to a second object. See the Put or Get command for an example.

oThe Object.PutToFile(), Object.PutToString(), Object.GetFromFile(), and Object.GetFromString() methods can also be used in place of the Put and Get commands.


Assigning plot-related Series, Font, Title, Axis, and Legend Objects equal to other Objects of the same type works differently than how the assign (=) operator works with Spacecraft or GroundStation Objects. With plot-related objects, assignment of two objects will assign the properties of all their child objects as well. For example, for an Axis, its child Font and Title objects will be assigned (as well as the Font of the Title child object).


Note: When assigning one object to another, the Name property will not transfer in order to keep the names of the objects unique. You are able to assign the name explicitly if desired (e.g. Spacecraft1.Name = Spacecraft2.Name).


Command Editor

Left side of expression

Defines the object, property, or method that is to be set

oArray element


oObject property/method


Right side of expression

Defines the value that will be set for the left side of the expression

oArray element

oFunction call



oObject property/method


"More" button

Adds additional fields to the right side of the expression

New fields will be combined with previous fields through addition, subtraction, multiplication, or division


"Delete" button

Appears when multiple fields exist on the right side of the expression

Removes the field located to the left of the “Delete” button



Displays the FreeFlyer Script that is generated by the editor



Displays descriptions of the editor and its fields

Description text changes as the mouse pointer moves over the different fields within the editor




See Also

Script Operators