public virtual void UpdateCalculatedEndPosition(CommandState state) { if (PositionValid) { var sc = new Point3D(); double val; if (TryGetVariable('X', state, out val)) { sc.X = val; } if (TryGetVariable('Y', state, out val)) { sc.Y = val; } if (TryGetVariable('Z', state, out val)) { sc.Z = val; } if (!sc.HasAllValues && PrevCommand != null) { sc.AssignMissing(PrevCommand.CalculatedEndPosition); } _calculatedEndPosition = sc; } else { _calculatedEndPosition = PrevCommand == null ? new Point3D() : PrevCommand._calculatedEndPosition; } }