//
        // CADFile & Co Stuff
        //
        #region CADFile, Parts, MOPs and Tools

        //
        // Extents
        //
        /// <summary>
        /// Extension to GetScreenExtents
        ///
        /// Original does not take Toolpaths into account
        /// </summary>
        /// <param name="cadfile"></param>
        /// <param name="min"></param>
        /// <param name="max"></param>
        /// <param name="t"></param>
        public static void GetScreenExtentsEx(this CADFile cadfile, ref PointF min, ref PointF max, Matrix4x4F t)
        {
            cadfile.GetScreenExtents(ref min, ref max, t);

            PointF localMin = PointF.Empty;
            PointF localMax = PointF.Empty;

            foreach (CAMPart part in cadfile.Parts)
            {
                foreach (MachineOp mop in part.MachineOps)
                {
                    if (mop.Toolpaths2 != null)
                    {
                        foreach (ToolpathItem item in mop.Toolpaths2.Toolpaths)
                        {
                            item.Toolpath.GetScreenExtents(ref localMin, ref localMax, item.Toolpath.Transform * t, CamBamConfig.Defaults.ViewProjectionMode == ProjectionModes.Perspective);

                            if (double.IsNaN(min.X) || double.IsNaN(max.X) ||
                                double.IsNaN(min.Y) || double.IsNaN(max.Y))
                            {
                                min = localMin;
                                max = localMax;

                                continue;
                            }

                            if (!double.IsNaN(localMax.X))
                            {
                                max.X = Math.Max(max.X, localMax.X);
                            }

                            if (!double.IsNaN(localMax.Y))
                            {
                                max.Y = Math.Max(max.Y, localMax.Y);
                            }

                            if (!double.IsNaN(localMin.X))
                            {
                                min.X = Math.Min(min.X, localMin.X);
                            }

                            if (!double.IsNaN(localMin.Y))
                            {
                                min.Y = Math.Min(min.Y, localMin.Y);
                            }
                        }
                    }
                }
            }
        }
示例#2
0
 public MOPTrochoprof(CADFile CADFile, ICollection <Entity> plist) : base(CADFile, plist)
 {
 }
示例#3
0
文件: mop.cs 项目: robgrz/matmill
 public Trochomop(CADFile CADFile, ICollection <Entity> plist) : base(CADFile, plist)
 {
 }
        public static ToolDefinition ActiveTool(this CADFile file)
        {
            CAMPart part = file.ActivePart();

            return(part != null?part.ActiveTool() : null);
        }
        public static ToolDefinition FirstTool(this CADFile file)
        {
            CAMPart part = file.FirstPart();

            return(part != null?part.FirstTool() : null);
        }
        public static MachineOp ActiveMOP(this CADFile file)
        {
            CAMPart part = file.ActivePart();

            return(part != null?part.ActiveMOP() : null);
        }
        public static MachineOp FirstMOP(this ICADView view)
        {
            CADFile file = view.CADFile;

            return(file != null?file.FirstMOP() : null);
        }
        public static MachineOp FirstMOP(this CADFile file)
        {
            CAMPart part = file.FirstPart();

            return(part != null?part.FirstMOP() : null);
        }
 public static CAMPart ActivePart(this CADFile file)
 {
     return(file.ActivePart);
 }
        public static CAMPart FirstPart(this ICADView view)
        {
            CADFile file = view.CADFile;

            return(file != null?file.FirstPart() : null);
        }
        //
        // Parts
        //

        public static CAMPart FirstPart(this CADFile file)
        {
            return(file.Parts != null && file.Parts.Count != 0 ? file.Parts[0] : null);
        }