CApphot:Copy
The Copy method duplicates the current CApphot and returns the new object. All properties are copied.
A = CApphot:Copy() |
A is a new CApphot containing the same properties as the current one. In place of CApphot, use the name of the actual object to be copied (see Remarks).
This method copies an existing CApphot and returns a reference to the new CApphot. You cannot copy a CApphot or any other class object using the trivial statement B = A, as this simply makes the value of B a reference to the object A. In other words, B becomes an alias to A. To get around this, two copy methods are provided by the CApphot class:
1. To create a CApphot that is a copy of the current object, use the Copy method. This creates a new CApphot B before duplicating the values of the current object A. For example,
B = A:Copy() |
-- Object A already exists, B is automatically created. |
2. To create a new CApphot that is a copy of an existing object (including all properties), use the copy constructor, as in
B = new_apphot(A) |
-- Object A already exists, B is automatically created. |
You can choose the copying syntax that fits best with your script.
The following script copies the members of CApphot A into a new CApphot A2:
|
|
|
-- construct a new CApphot object |
|
-- Set the value of nRadius1 |
|
-- Set the value of nRadius2 |
|
-- Set the value of nRadius3 |
|
-- Measure object at (x,y) in CImage I |
|
-- result: A Mag = 15.256 |
|
-- create a copy of A, including measurements |
|
-- result: B Mag = 15.256 |
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.