/// <summary>
        /// 移动
        /// </summary>
        /// <param name="vec"></param>
        /// <returns></returns>
        public bool MovePositionBuilder(Vector3d vec)
        {
            try
            {
                Matrix4 inv = this.work.Info.Matr.GetInversMatrix();
                CartesianCoordinateSystem csys        = BoundingBoxUtils.CreateCoordinateSystem(this.work.Info.Matr, inv);
                ElectrodeSetValueInfo     setValue    = ElectrodeSetValueInfo.GetAttribute(eleComp);
                ElectrodeSetValueInfo     newSetValue = setValue.Clone() as ElectrodeSetValueInfo;

                AssmbliesUtils.MoveCompPart(eleComp, vec, work.Info.Matr);
                NXObject instance = AssmbliesUtils.GetOccOfInstance(eleComp.Tag);
                BodyInfo info     = GetDischargeFace(csys, eleComp);
                newSetValue.EleSetValue[0]    = setValue.EleSetValue[0] + vec.X;
                newSetValue.EleSetValue[1]    = setValue.EleSetValue[1] + vec.Y;
                newSetValue.EleSetValue[2]    = setValue.EleSetValue[2] + vec.Z;
                newSetValue.Positioning       = GetPositionName();
                newSetValue.PositioningRemark = "设定值改变";
                if (info != null)
                {
                    newSetValue.ContactArea   = info.ContactArea;
                    newSetValue.ProjectedArea = info.GetProjectedArea(csys, this.work.Info.Matr);
                }
                newSetValue.SetAttribute(instance);
                return(true);
            }
            catch (NXException ex)
            {
                ClassItem.WriteLogFile("电极跑位错误!" + ex.Message);
                return(false);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 移动电极
 /// </summary>
 /// <param name="dir"></param>
 /// <returns></returns>
 private bool MoveElePart(int dir)
 {
     if ((this.eleModel.EleInfo.PitchXNum > 1 && Math.Abs(this.eleModel.EleInfo.PitchX) > 0) ||
         (this.eleModel.EleInfo.PitchYNum > 1 && Math.Abs(this.eleModel.EleInfo.PitchY) > 0))
     {
         Vector3d vec = new Vector3d();
         vec.X = (this.eleModel.EleInfo.PitchXNum - 1) * this.eleModel.EleInfo.PitchX * dir;
         vec.Y = (this.eleModel.EleInfo.PitchYNum - 1) * this.eleModel.EleInfo.PitchY * dir;
         AssmbliesUtils.MoveCompPart(this.eleModel.GetPartComp(workPart), vec, this.work.WorkMatr);
         return(true);
     }
     return(false);
 }
 /// <summary>
 /// 移动电极
 /// </summary>
 /// <param name="dir"></param>
 /// <returns></returns>
 private bool MoveElePart(Component eleCt, ElectrodePitchInfo pitch, int dir)
 {
     if ((pitch.PitchXNum > 1 && Math.Abs(pitch.PitchX) > 0) ||
         (pitch.PitchYNum > 1 && Math.Abs(pitch.PitchY) > 0))
     {
         Vector3d vec = new Vector3d();
         vec.X = (pitch.PitchXNum - 1) * pitch.PitchX * dir;
         vec.Y = (pitch.PitchYNum - 1) * pitch.PitchY * dir;
         AssmbliesUtils.MoveCompPart(eleCt, vec, this.work.Info.Matr);
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
 public bool CreateElectrode(bool zDatum, double zHeight, Action exp)
 {
     NXOpen.Assemblies.Component eleComp = this.CreateElePart();
     if (eleComp != null)
     {
         exp.Invoke();
         this.CreateBodyFeature(zHeight);
         this.CreateSeat(zHeight, zDatum);
         CreateCenterPoint();
         PartUtils.SetPartWork(null);
         Vector3d vec = GetMove();
         AssmbliesUtils.MoveCompPart(eleComp, vec, head.ConditionModel.Work.WorkMatr); //移动装配
         MoveObjectLayer(100 + eleInfo.EleNumber, this.head.ConditionModel.Bodys.ToArray());
         return(true);
     }
     return(false);
 }
Exemplo n.º 5
0
        private void AlterElectrode(ElectrodeInfo newEleInfo, ElectrodeModel model)
        {
            // Part workPart = Session.GetSession().Parts.Work;
            PartUtils.SetPartDisplay(work.PartTag);
            double[] temp = new double[3];
            for (int i = 0; i < 3; i++)
            {
                temp[i] = AttributeUtils.GetAttrForDouble(model.PartTag, "EleSetValue", i);
            }
            Point3d oldPt = new Point3d(temp[0], temp[1], temp[2]);
            Point3d newPt = new Point3d(newEleInfo.EleSetValue[0], newEleInfo.EleSetValue[1], newEleInfo.EleSetValue[2]);
            Point3d dis   = GetSingleToothDis(newEleInfo, model.EleInfo, oldPt);
            //  newEleInfo.Positioning = model.EleInfo.Positioning;
            string pos = model.EleInfo.Positioning;

            model.EleInfo = newEleInfo;
            newEleInfo.SetAttribute(model.PartTag);
            AttributeUtils.AttributeOperation("Positioning", pos, model.PartTag);
            if (!UMathUtils.IsEqual(oldPt, newPt))
            {
                NXOpen.Assemblies.Component ct = AssmbliesUtils.GetPartComp(work.PartTag, model.PartTag);
                PartUtils.SetPartWork(ct);
                Vector3d move = new Vector3d(0, 0, 0);
                move.X = newPt.X - oldPt.X - dis.X;
                move.Y = newPt.Y - oldPt.Y - dis.Y;

                Body[] bodys = model.PartTag.Bodies.ToArray();
                if (bodys.Length > 1)
                {
                    AlterMove(model);
                    DeleteObject.UpdateObject();
                    CreateUnite(bodys);
                }
                PartUtils.SetPartWork(null);
                AssmbliesUtils.MoveCompPart(ct, move, this.work.WorkMatr);
            }
            DeleteObject.UpdateObject();
        }
Exemplo n.º 6
0
        /// <summary>
        /// 移动体
        /// </summary>
        /// <param name="eleAsmComp"></param>
        /// <returns></returns>
        private bool UpdateMoveComp(NXOpen.Assemblies.Component eleAsmComp)
        {
            ElectrodeAllInfo      all          = newAllInfo.Clone() as ElectrodeAllInfo;
            ElectrodeSetValueInfo setValueInfo = ElectrodeSetValueInfo.GetAttribute(eleAsmComp);
            Part                 workPt        = eleAsmComp.Parent.Prototype as Part;
            WorkModel            work          = new WorkModel(workPt);
            ElectrodePitchUpdate pitchUpdate   = new ElectrodePitchUpdate(oldAllInfo.Pitch, newAllInfo.Pitch);
            Vector3d             temp          = pitchUpdate.GetIncrement();

            double[] setValue = pitchUpdate.GetNewSetValue(setValueInfo.EleSetValue);
            setValueInfo.EleSetValue = setValue;
            all.SetValue             = setValueInfo;
            try
            {
                PartUtils.SetPartDisplay(asm);
                AssmbliesUtils.MoveCompPart(eleAsmComp, temp, work.Info.Matr);
                NXObject obj = AssmbliesUtils.GetOccOfInstance(eleAsmComp.Tag);
                foreach (NXOpen.Assemblies.Component ct in AssmbliesUtils.GetPartComp(work.PartTag, eleModel.PartTag))
                {
                    NXObject tem = AssmbliesUtils.GetOccOfInstance(ct.Tag);
                    if (tem.Equals(obj))
                    {
                        PartUtils.SetPartDisplay(work.PartTag);
                        AssmbliesUtils.MoveCompPart(ct, temp, work.Info.Matr);
                    }
                }
                PartUtils.SetPartDisplay(asm);
                all.SetAttribute(obj);
                return(true);
            }
            catch (NXException ex)
            {
                ClassItem.WriteLogFile("移动组件错误!" + ex.Message);
                return(false);
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// 移动装配
 /// </summary>
 /// <param name="workMat"></param>
 /// <param name="vec"></param>
 /// <returns></returns>
 public void MoveEleComp(Matrix4 workMat, Vector3d vec)
 {
     AssmbliesUtils.MoveCompPart(this.EleComp, vec, workMat); //移动装配
 }