public void ResetFromSelection() { if (InteractionContext.SingleSelection as ICustomObject == null) { return; } toolPathObj = FaceToolPathObject.GetWrapper((InteractionContext.SingleSelection as ICustomObject).Master); if (toolPathObj == null || toolPathObj.IDesFace == null) { TransportControls.IsEnabled = false; return; } toolPath = toolPathObj.ToolPath; locations = toolPathObj.ToolPath.CutterLocations; timeToLocation = new double[locations.Count]; time = 0; totalTime = 0; timeToLocation[0] = 0; for (int i = 0; i < locations.Count - 1; i++) { double length = (locations[i + 1].Point - locations[i].Point).Magnitude; totalLength += length; double rate = locations[i + 1].IsRapid ? toolPath.CuttingParameters.FeedRateRapid : toolPath.CuttingParameters.FeedRate; double dtime = length / rate; totalTime += dtime; timeToLocation[i + 1] = totalTime; } timeToLocation = timeToLocation.Distinct().ToArray(); SetGraphics(); TransportControls.IsEnabled = true; TransportControls.Reset(this); }
protected override void OnInitialize(Command command) { TransportControls.Initialize(); SpeedSlider.Initialize(); }