Ejemplo n.º 1
0
        public override bool SetValue(IDocObject obj, string value)
        {
            Debug.Assert(obj != null);
            Debug.Assert(!string.IsNullOrEmpty(value));

            var iCustomObj  = (ICustomObject)obj;
            var toolPathObj = FaceToolPathObject.GetWrapper(iCustomObj.Master);

            toolPathObj.ToolPath.Strategy = FaceToolPathObject.TypeNames.Keys.Where(s => FaceToolPathObject.TypeNames[s] == value).First();
            toolPathObj.Regenerate();
            return(true);
        }
Ejemplo n.º 2
0
        protected override IDocObject AdjustSelection(IDocObject docObject)
        {
            if (docObject as ICustomObject == null)
            {
                return(null);
            }

            FaceToolPathObject toolPathObj = FaceToolPathObject.GetWrapper((docObject as ICustomObject).Master);

            if (toolPathObj != null && toolPathObj.IDesFace != null)
            {
                return(docObject);
            }

            return(null);
        }
Ejemplo n.º 3
0
        public override string GetValue(IDocObject obj)
        {
            Debug.Assert(obj != null);

            var iCustomObj = obj as ICustomObject;

            if (iCustomObj != null)
            {
                var toolPathObj = FaceToolPathObject.GetWrapper(iCustomObj.Master);
                if (toolPathObj != null)
                {
                    return(toolPathObj.Color.Name);
                }
            }
            return(null);
        }
Ejemplo n.º 4
0
        public override string GetValue(IDocObject obj)
        {
            Debug.Assert(obj != null);

            var iCustomObj = obj as ICustomObject;

            if (iCustomObj != null)
            {
                var toolPathObj = FaceToolPathObject.GetWrapper(iCustomObj.Master);
                if (toolPathObj != null)   // && toolPathObj.HasToolPath) {
                {
                    return(FaceToolPathObject.TypeNames[toolPathObj.ToolPath.Strategy]);
                }
            }
            return(null);
        }
Ejemplo n.º 5
0
        public override string GetValue(IDocObject obj)
        {
            Debug.Assert(obj != null);

            var iCustomObj = obj as ICustomObject;

            if (iCustomObj != null)
            {
                var toolPathObj = FaceToolPathObject.GetWrapper(iCustomObj.Master);
                if (toolPathObj != null)   // && toolPathObj.HasToolPath) {
                {
                    return(Window.ActiveWindow.Units.Length.Format(getValue(toolPathObj)));
                }
            }
            return(null);
        }
Ejemplo n.º 6
0
        public override bool SetValue(IDocObject obj, string value)
        {
            Debug.Assert(obj != null);
            Debug.Assert(!string.IsNullOrEmpty(value));

            var iCustomObj  = (ICustomObject)obj;
            var toolPathObj = FaceToolPathObject.GetWrapper(iCustomObj.Master);

            for (int i = 0; i < ColorList.Length; i++)
            {
                if (AllowableValues.ToArray()[i] == value)
                {
                    toolPathObj.Color = ColorList[i];
                    break;
                }
            }
            //           toolPathObj.Regenerate();
            return(true);
        }
Ejemplo n.º 7
0
        public override bool SetValue(IDocObject obj, string value)
        {
            Debug.Assert(obj != null);
            Debug.Assert(!string.IsNullOrEmpty(value));

            double val;

            if (!Window.ActiveWindow.Units.Length.TryParse(value, out val))
            {
                return(false);
            }
            if (Accuracy.LengthIsNegative(val))
            {
                return(false);
            }

            var iCustomObj  = (ICustomObject)obj;
            var toolPathObj = FaceToolPathObject.GetWrapper(iCustomObj.Master);

            setValue(toolPathObj, val);
            toolPathObj.Regenerate();
            return(true);
        }
Ejemplo n.º 8
0
        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);
        }