Exemplo n.º 1
0
        /// <summary>
        /// 创建中心点
        /// </summary>
        private void CreateCenterPoint(ElectrodePartBuilder part, bool zDatum)
        {
            UFSession theUFSession = UFSession.GetUFSession();
            Point3d   center       = part.GetSetValuePoint(zDatum);
            Matrix4   inver        = condition.Work.Info.Matr.GetInversMatrix();

            inver.ApplyPos(ref center);
            this.condition.ExpAndMatr.Matr.EleMatr.ApplyPos(ref center);
            Point pt = PointUtils.CreatePointFeature(center);

            pt.Color = 186;
            pt.Layer = 254;
            theUFSession.Obj.SetName(pt.Tag, "SetValuePoint");
        }
Exemplo n.º 2
0
        public List <string> CreateBuider()
        {
            List <string>        err  = new List <string>();
            ElectrodePartBuilder part = new ElectrodePartBuilder(GetEleInfo(), condition.Work.WorkpieceDirectoryPath);
            bool ptOk = part.CreatPart();

            if (ptOk)
            {
                List <Body>           bodys     = new List <Body>();
                List <Body>           headBodys = new List <Body>();
                bool                  isok      = false;
                ElectrodeDatumBuilder datum     = null;
                try
                {
                    headBodys = part.WaveEleHeadBody(condition.HeadBodys);
                }
                catch (NXException ex)
                {
                    err.Add("连接体错!             " + ex.Message);
                    return(err);
                }
                try
                {
                    isok = condition.ExpAndMatr.Exp.CreateExp(zDatum, allInfo.Preparetion.Preparation);
                }
                catch (NXException ex)
                {
                    err.Add("创建表达式错误!         " + ex.Message);
                    return(err);
                }
                try
                {
                    ElectrodeSketchBuilder sketch = new ElectrodeSketchBuilder(allInfo.Preparetion.Preparation[0], allInfo.Preparetion.Preparation[1], -allInfo.Datum.EleHeight);
                    datum = new ElectrodeDatumBuilder(sketch);
                    ElectrodeMoveBuilder move = new ElectrodeMoveBuilder(headBodys, allInfo.Datum, allInfo.GapValue, allInfo.Pitch);
                    datum.SetParentBuilder(sketch);
                    sketch.SetParentBuilder(move);
                    sketch.CreateBuilder();
                    move.CreateBuilder();
                    datum.CreateBuilder();
                    bodys.AddRange(move.AllBodys);
                    if (zDatum)
                    {
                        ElectrodeFeelerBuilder feeler = new ElectrodeFeelerBuilder(sketch, this.allInfo.Datum);
                        feeler.CreateBuilder();
                        bodys.Add(feeler.FeelerBody);
                    }
                }
                catch (NXException ex)
                {
                    err.Add("创建电极特征错误!          " + ex.Message);
                    return(err);
                }
                try
                {
                    string errs;
                    Body   by = CreateUnite(datum.DatumBody, bodys, out errs);
                    SetEleColor(by);
                    if (errs != "")
                    {
                        err.Add(errs);
                    }
                }
                catch (NXException ex)
                {
                    err.Add("电极求和错误!          " + ex.Message);
                }
                CreateCenterPoint(part, zDatum);
                PartUtils.SetPartWork(null);
                part.MoveEleComp(condition.Work.Info.Matr, part.GetMove(zDatum));
                MoveHeadTolayer();
                MoveEleComp(part.EleComp);
            }
            else
            {
                err.Add("创建电极档错误!");
            }

            return(err);
        }