Sets and gets the “total position” of the location_object.
location_object.Pos = <specified_location_value>
-or-
...location_object.Pos
Prerequisites
None
Parameters
None
Remarks
The Pos operation accesses the “total position” of both Cartesian and Angles Location Objects. For Cartesian Locations without reference frames, the “total position” is equal to the PosWrtRef value stored as a Cartesian position and orientation in the location_object. For Cartesian Locations with reference frames, the “total position” is equal to the PosWrtRef value of the location_object evaluated with respect to the “total position” of its reference frames. For Angles Locations, the “total value” is the equal to the set of axes positions stored in the location_object.
The Pos set operation works properly on all varieties of Locations. However, the type of the <specified_location_value> must match the type of the location_object, i.e. they must both either be Cartesian or Angles.
For Cartesian Locations, the “total position” of the location_object is set equal to the “total position” of the <specified_location_value>. If the location_object does not have an associated reference frame, the PosWrtRef value is set equal to the “total position” of the <specified_location_value>. If the location_object has a reference frame, the PosWrtRef value of the location_object is set such that the combination of the new PosWrtRef value of the location_object and its reference frame will be equal to the “total position” of the <specified_location_value>. If the location_object is an Angles type, the value of the location_object’s axes positions are set equal to the axes positions of the <specified_location_value>.
While the Pos method is similar to assigning a location_object to the value of another Location Object, it is important to understand the differences. The statement:
location_object = location_object2
assigns a pointer to location_object2’s data to the location_object. Not only does this operation supercede any reference frame you may have assigned to location_object, it also supercedes any other data assigned, such as its ZClearance information. Furthermore, if you subsequently make a change to the data of either location_object or location_object2, the data for both objects will be effected. Alternatively, you could use the following assignment statement:
location_object = location_object2.Clone
This statement makes a copy of location_object2’s value before assigning it to location_object. This statement does eliminate the potential problem of having two variables inadvertently referencing the same data. However, this operation still supercedes location_object's original reference frame specification and other data. Also, one additional downside of this operation is that creating a copy of an object’s value does incur a certain amount of system overhead.
On the other hand, the statement:
location_object.Pos= location_object2
alters the PosWrtRef or Angles values of location_object with low overhead and preserves all of the other properties of the location_object.
If the goal of a statement is simply to update the existing “total position” or PosWrtRef value of a Location without regard to the reference frame, you should normally make use of either the Pos or PosWrtRef set properties.
Regarding the Pos get operation, this property returns a Location Object that contains only the “total position” of the location_object with no reference frame or other data. Please note that if the location_object is a Cartesian type with a reference frame, the position and orientation of the PosWrtRef value and the “total position” of the reference frame are combined and returned as the PosWrtRef value of the returned Object.
For all cases the value of the returned Object from the Pos get operation is as follows:
Property | Returned Location Object value |
---|---|
Type |
Cartesian or Angles Location as appropriate |
PosWrtRef or Angles |
“total position” of the location_object |
RefFrame |
Always NULL |
ZClearance |
1.0e32 to indicate not initialized |
All other properties |
Always zeroed. |
Examples
Dim loc1 As New Location ' Create new Location set to defaults
Dim loc2 As New Location
loc1.ZClearance = 12
loc2.XYZ(10,20,30,0,180,23) ' Define PosWrtRef value for loc2
loc1.Pos = loc2 ' Use same "total position" for loc1
See Also
Location Class | location_object.Inverse |location_object.Mul |location_object.PosWrtRef