Table of Contents

Class TimeShift

Namespace
Hi.Numerical.StepSelectionUtils
Assembly
HiMech.dll

Represents a time-based shift operation for machining steps. This class provides functionality to shift step indices based on time offsets.

public class TimeShift : IStepShift, IMakeXmlSource
Inheritance
TimeShift
Implements
Inherited Members
Extension Methods

Constructors

TimeShift(TimeSpan, bool)

Initializes a new instance of the TimeShift class with the specified parameters.

public TimeShift(TimeSpan timeShift, bool isBackward)

Parameters

timeShift TimeSpan

The amount of time to shift.

isBackward bool

True to shift backward in time, false to shift forward.

TimeShift(XElement)

Initializes a new instance of the TimeShift class from XML.

public TimeShift(XElement src)

Parameters

src XElement

The XML element containing the time shift configuration.

Properties

IsBackward

Gets or sets a value indicating whether the shift is backward in time. When true, shifts steps earlier in time; when false, shifts steps later in time.

public bool IsBackward { get; set; }

Property Value

bool

ShiftTimeSpan

Gets or sets the amount of time to shift.

public TimeSpan ShiftTimeSpan { get; set; }

Property Value

TimeSpan

XName

Gets the XML element name used for serialization.

public static string XName { get; }

Property Value

string

Remarks

This name is used as the XML tag when serializing/deserializing TimeShift instances. The value is the unqualified name of the class (TimeShift).

Methods

GetShiftedStepIndex(ClStrip, int)

Gets the shifted step index based on the original index and the time shift configuration.

public int GetShiftedStepIndex(ClStrip host, int originalStepIndex)

Parameters

host ClStrip

The cutter location strip containing the steps.

originalStepIndex int

The original step index to shift.

Returns

int

The shifted step index, or -1 if the shift results in an invalid index.

MakeXmlSource(string, string, bool)

Creates an XML representation of the object. This method may also generate additional resources such as related files.

public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)

Parameters

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if true, the extended file creation is suppressed.

Returns

XElement

An XML element representing the object's state

Remarks

For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied. The baseDirectory is typically the folder at the nearest configuration file folder. Since the folder can be moving with the configuration file.