Esempio n. 1
0
        protected bool IsPassThrough(AbstractCylinderBody ab, double start, double end)
        {
            double  anlge   = UMathUtils.Angle(analysis.Matr.GetZAxis(), ab.Direction);
            Point3d startPt = ab.StratPt;
            Point3d endPt   = ab.EndPt;

            this.analysis.Matr.ApplyPos(ref startPt);
            this.analysis.Matr.ApplyPos(ref endPt);

            if (UMathUtils.IsEqual(anlge, 0))
            {
                if (startPt.Z > start && endPt.Z < end)
                {
                    return(true);
                }
            }
            if (UMathUtils.IsEqual(anlge, Math.PI))
            {
                if (startPt.Z < start && endPt.Z > end)
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 2
0
        public override List <StandardPartsName> GetGuidePillar()
        {
            List <MoldBaseModel>        dowFace = this.FaceEiectorPlates.FindAll(a => a.CenterPt.Z < 0);
            List <MoldBaseModel>        dow     = this.DowEiectorPlates.FindAll(a => a.CenterPt.Z < 0);
            List <AbstractCylinderBody> pillars = new List <AbstractCylinderBody>();
            List <AbstractCylinderBody> pillar  = this.cylinderBody.FindAll(a => a.Radius >= 7 && a.IsGuidePillar());

            foreach (AbstractCylinderBody ab in pin)
            {
                AbstractCylinderBody pi = pillar.Find(a => UMathUtils.IsEqual(a.StratPt.X, ab.StratPt.X) && UMathUtils.IsEqual(a.StratPt.Y, ab.StratPt.Y));
                //if (!pillars.Exists(a => a.Equals(pi)))
                //{
                //    pillars.Add(pi);
                //}
                if (pi != null)
                {
                    pi.Name = "导柱";
                    pillars.Add(pi);
                    pillar.Remove(pi);
                }
            }
            if (this.SupportPlate != null && dowFace.Count != 0 && dow.Count != 0)
            {
                foreach (AbstractCylinderBody ab in pillar)
                {
                    Point3d start = ab.StratPt;
                    Point3d end   = ab.EndPt;
                    this.analysis.Matr.ApplyPos(ref start);
                    this.analysis.Matr.ApplyPos(ref end);
                    Vector3d vec = UMathUtils.GetVector(this.DowEiectorPlates[0].CenterPt, this.SupportPlate.CenterPt);
                    if (UMathUtils.IsEqual(UMathUtils.Angle(vec, ab.Direction), 0) &&
                        UMathUtils.IsEqual(start.Z, dow[0].CenterPt.Z + dow[0].DisPt.Z) &&
                        end.Z > this.SupportPlate.CenterPt.Z - this.SupportPlate.DisPt.Z)
                    {
                        ab.Name = "回针";
                        pillars.Add(ab);
                    }
                }
            }
            else if (this.SupportPlate == null && dowFace.Count != 0 && dow.Count != 0)
            {
                foreach (AbstractCylinderBody ab in pillar)
                {
                    Point3d start = ab.StratPt;
                    Point3d end   = ab.EndPt;
                    this.analysis.Matr.ApplyPos(ref start);
                    this.analysis.Matr.ApplyPos(ref end);
                    Vector3d vec = UMathUtils.GetVector(this.DowEiectorPlates[0].CenterPt, this.BMoldBase.CenterPt);
                    if (UMathUtils.IsEqual(UMathUtils.Angle(vec, ab.Direction), 0) &&
                        UMathUtils.IsEqual(start.Z, dow[0].CenterPt.Z + dow[0].DisPt.Z) &&
                        end.Z > this.BMoldBase.CenterPt.Z - this.BMoldBase.DisPt.Z)
                    {
                        ab.Name = "回针";
                        pillars.Add(ab);
                    }
                }
            }
            return(GetCyliderName(pillars));
        }
Esempio n. 3
0
        /// <summary>
        /// 获取模板和圆柱形
        /// </summary>
        /// <returns></returns>
        public void GetBase(out List <MoldBaseModel> moldBase, out List <AbstractCylinderBody> cylinder)
        {
            moldBase = new List <MoldBaseModel>();
            cylinder = new List <AbstractCylinderBody>();

            foreach (Body by in workPart.Bodies)
            {
                MoldBaseModel mm = new MoldBaseModel(by, this.Matr, csys);
                if ((UMathUtils.IsEqual(mm.CenterPt.X, 0) && UMathUtils.IsEqual(mm.CenterPt.Y, 0)) &&
                    ((Math.Round(mm.DisPt.X, 4) >= Math.Round(AMoldBase.DisPt.X, 4) &&
                      Math.Round(mm.DisPt.Y, 4) >= Math.Round(AMoldBase.DisPt.Y, 4))))
                {
                    moldBase.Add(mm);
                }
                else
                {
                    StepBuilder builder;
                    if (mm.DisPt.Z > mm.DisPt.X && mm.DisPt.Z > mm.DisPt.Y)
                    {
                        BodyCircleFeater bf = new BodyCircleFeater(by);
                        if (bf.IsCylinderBody(out builder))
                        {
                            AbstractCylinderBody ab = CylinderBodyFactory.Create(builder);
                            if (ab != null)
                            {
                                double angle = UMathUtils.Angle(ab.Direction, this.Matr.GetZAxis());
                                if (UMathUtils.IsEqual(angle, 0) || UMathUtils.IsEqual(angle, Math.PI))
                                {
                                    cylinder.Add(ab);
                                }
                            }
                        }
                    }
                    else if ((UMathUtils.IsEqual(mm.CenterPt.X, 0) || UMathUtils.IsEqual(mm.CenterPt.Y, 0)) &&
                             ((Math.Round(mm.DisPt.X, 4) >= Math.Round(AMoldBase.DisPt.X, 4) ||
                               Math.Round(mm.DisPt.Y, 4) >= Math.Round(AMoldBase.DisPt.Y, 4))))
                    {
                        moldBase.Add(mm);
                    }
                }
            }
        }
Esempio n. 4
0
        public static AbstractCylinderBody Create(StepBuilder builder)
        {
            int count = builder.CylFeater.Count;
            AbstractCylinderBody abs = null;

            switch (count)
            {
            case 1:
                abs = new CylinderBody(builder);
                break;

            case 2:
                abs = new CylinderTwoStepBody(builder);
                break;

            default:
                abs = new CylinderManyStepBody(builder);
                break;
            }
            return(abs);
        }