public PartFace(Point3d p1, Point3d p2, Point3d p3, Point3d p4, int number, Part p)
        {
            Point1 = p1;
            Point2 = p2;
            Point3 = p3;
            Point4 = p4;
            FaceNumber = number;
            Part = p;
            Plane = new Plane(p1, p2, p3);
            Points.Add(Point1);
            Points.Add(Point2);
            Points.Add(Point3);
            Points.Add(Point4);

            if (FaceNumber <= 4) IsHorizontalFace = true;
            else IsHorizontalFace = false;
        }
        public List<ModelError> GetPartsFromOneLine(IRange partRange, IProduct product, List<Part> parts, IWorkbookSet books, List<Material> tempMaterials, List<EdgeBanding> tempEdgebandings)
        {
            List<ModelError> errors = new List<ModelError>();

            PartChecker check = new PartChecker(partRange, errors);

            string partName = check.PartName();
            int qty = check.Qty();
            if (qty <= 0)
            {
                return errors;
            }

            double width = check.Width();
            double length = check.Length();

            Material material;
            double thick = check.Thick(books.Workbooks["M"], out material, tempMaterials, errors);

            EdgeBanding ebw1 = check.EBW1(books.Workbooks["E"], tempEdgebandings);
            EdgeBanding ebw2 = check.EBW2(books.Workbooks["E"], tempEdgebandings);
            EdgeBanding ebl1 = check.EBL1(books.Workbooks["E"], tempEdgebandings);
            EdgeBanding ebl2 = check.EBL2(books.Workbooks["E"], tempEdgebandings);

            int basepoint = check.BasePoint();
            MachinePoint machinePoint = check.MachinePoint();

            double xRotation = check.XRotation();
            double yRotation = check.YRotation();
            double zRotation = check.ZRotation();

            bool isDraw3d;
            string layname3d = check.Layname3d(out isDraw3d);
            string layname2d = partRange[0, 36].Text;

            if (width <= 0 || length <= 0 || thick <= 0)
            {
                return errors;
            }

            check.IsMaterialFitPartLengthAndWidth(length, width, material, errors);

            //TODO:tokens

            bool isEQPart = check.IsEQPart();
            if (isEQPart)
            {
                List<double[]> origins = check.Positions(qty, thick, product.Width);

                foreach (var d in origins)
                {
                    Part part = new Part(partName, 1, width, length, thick, material.Name,
                        ebw1.Name, ebw2.Name, ebl1.Name, ebl2.Name,
                        "", "", "",
                        basepoint, machinePoint.MP,
                        d[0], d[1], d[2], xRotation, yRotation, zRotation,
                        layname3d, layname2d,
                        product);
                    parts.Add(part);
                }
            }
            else
            {
                double xPos = check.XPosition();
                double yPos = check.YPosition();
                double zPos = check.ZPosition();
                Part part = new Part(partName, qty, width, length, thick, material.Name,
                    ebw1.Name, ebw2.Name, ebl1.Name, ebl2.Name,
                    "", "", "",
                    basepoint, machinePoint.MP,
                    xPos, yPos, zPos, xRotation, yRotation, zRotation,
                    layname3d, layname2d,
                    product);

                parts.Add(part);
            }

            return errors;
        }