コード例 #1
0
        private void UpdatePrototypeObject()
        {
            if (prototypeObj == null || prototypeObj.IsDeleted)
            {
                //     WriteBlock.ExecuteTask("Create preselection", () => prototypeObj = FaceToolPathObject.DefaultToolPathObject);
                prototypeObj = FaceToolPathObject.DefaultToolPathObject;
            }

            InteractionContext.SingleSelection = prototypeObj.Subject;
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #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)
                {
                    return(toolPathObj.Color.Name);
                }
            }
            return(null);
        }
コード例 #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(FaceToolPathObject.TypeNames[toolPathObj.ToolPath.Strategy]);
                }
            }
            return(null);
        }
コード例 #6
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);
        }
コード例 #7
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);
        }
コード例 #8
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);
        }
コード例 #9
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);
        }
コード例 #10
0
        public void HandleSelectionChanged()
        {
            IDocObject iDocObj = InteractionContext.SingleSelection;

            if (iDocObj != null && FaceToolPathObject.SelectedToolPath != null)
            {
                return;
            }

            UpdatePrototypeObject();
            if (iDocObj == null)
            {
                return;
            }

            var iDesFace = iDocObj as IDesignFace;

            if (iDesFace != null)
            {
                prototypeObj.IDesFace = iDesFace;
                prototypeObj          = null;
                return;
            }
        }