Ejemplo n.º 1
0
 private void CreateExpression(ElectrodePitchInfo pitch)
 {
     ExpressionUtils.CreateExp("xNCopies=" + pitch.PitchXNum.ToString(), "Number");
     ExpressionUtils.CreateExp("yNCopies=" + pitch.PitchYNum.ToString(), "Number");
     ExpressionUtils.CreateExp("xPitchDistance=" + pitch.PitchX.ToString(), "Number");
     ExpressionUtils.CreateExp("yPitchDistance=" + pitch.PitchY.ToString(), "Number");
 }
Ejemplo n.º 2
0
        public override bool CreateExp(bool zDatum, int[] pre = null)
        {
            bool isok = base.CreateDefault();

            try
            {
                ExpressionUtils.CreateExp("xNCopies=PitchYNum", "Number");
                ExpressionUtils.CreateExp("xPitchDistance=Pitchx", "Number");
                if (zDatum)
                {
                    ExpressionUtils.CreateExp("moveX=-(xNCopies-2)*xPitchDistance/2", "Number");
                    ExpressionUtils.CreateExp("moveBoxX=-(xNCopies)*xPitchDistance/2", "Number");
                    ExpressionUtils.CreateExp("moveBoxY=0", "Number");
                    ExpressionUtils.CreateExp("moveBoxZ=0", "Number");
                }
                else
                {
                    ExpressionUtils.CreateExp("moveX=-(xNCopies-1)*xPitchDistance/2", "Number");
                }
                return(isok);
            }
            catch (NXException ex)
            {
                ClassItem.WriteLogFile("创建表达式错误!" + ex.Message);
                return(false);
            }
        }
Ejemplo n.º 3
0
 private void CreateExpression(double x, int xNumber, double y, int yNumber)
 {
     ExpressionUtils.CreateExp("xNCopies=" + xNumber.ToString(), "Number");
     ExpressionUtils.CreateExp("yNCopies=" + yNumber.ToString(), "Number");
     ExpressionUtils.CreateExp("xPitchDistance=" + x.ToString(), "Number");
     ExpressionUtils.CreateExp("yPitchDistance=" + y.ToString(), "Number");
 }
Ejemplo n.º 4
0
        protected void CreateDefault(bool zDatum)
        {
            ExpressionUtils.SetAttrExp("PitchX", "PitchX", NXObject.AttributeType.Real);
            ExpressionUtils.SetAttrExp("PitchXNum", "PitchXNum", NXObject.AttributeType.Integer);
            ExpressionUtils.SetAttrExp("PitchY", "PitchY", NXObject.AttributeType.Real);
            ExpressionUtils.SetAttrExp("PitchYNum", "PitchYNum", NXObject.AttributeType.Integer);
            ExpressionUtils.SetAttrExp("PreparationX", "Preparation", NXObject.AttributeType.Integer, 0);
            ExpressionUtils.SetAttrExp("PreparationY", "Preparation", NXObject.AttributeType.Integer, 1);
            ExpressionUtils.SetAttrExp("DatumWidth", "DatumWidth", NXObject.AttributeType.Real);
            //ExpressionUtils.EditExp(ExpressionUtils.GetExpByName("xNCopies"), "PitchXNum");
            //ExpressionUtils.EditExp(ExpressionUtils.GetExpByName("yNCopies"), "PitchYNum");
            //ExpressionUtils.EditExp(ExpressionUtils.GetExpByName("xPitchDistance"), "PitchX");
            //ExpressionUtils.EditExp(ExpressionUtils.GetExpByName("yPitchDistance"), "-PitchY");

            ExpressionUtils.CreateExp("xNCopies=PitchXNum", "Number");
            ExpressionUtils.CreateExp("yNCopies=PitchYNum", "Number");
            ExpressionUtils.CreateExp("xPitchDistance=PitchX", "Number");
            ExpressionUtils.CreateExp("yPitchDistance=-PitchY", "Number");

            if (zDatum)
            {
                ExpressionUtils.CreateExp("moveBoxX=0", "Number");
                ExpressionUtils.CreateExp("moveBoxY=0", "Number");
                ExpressionUtils.CreateExp("moveBoxZ=0", "Number");
            }


            ExpressionUtils.CreateExp("moveX=0", "Number");
            ExpressionUtils.CreateExp("moveY=0", "Number");
            ExpressionUtils.CreateExp("moveZ=0", "Number");
        }
        /// <summary>
        /// 创建表达式
        /// </summary>
        /// <param name="zDatum"></param>
        /// <param name="pre"></param>
        /// <returns></returns>
        public bool CreateExp(bool zDatum, int[] pre)
        {
            try
            {
                ExpressionUtils.SetAttrExp("PitchX", "PitchX", NXObject.AttributeType.Real);
                ExpressionUtils.SetAttrExp("PitchXNum", "PitchXNum", NXObject.AttributeType.Integer);
                ExpressionUtils.SetAttrExp("PitchY", "PitchY", NXObject.AttributeType.Real);
                ExpressionUtils.SetAttrExp("PitchYNum", "PitchYNum", NXObject.AttributeType.Integer);

                ExpressionUtils.SetAttrExp("PreparationX", "Preparation", NXObject.AttributeType.Integer, 0);
                ExpressionUtils.SetAttrExp("PreparationY", "Preparation", NXObject.AttributeType.Integer, 1);
                ExpressionUtils.SetAttrExp("PreparationZ", "Preparation", NXObject.AttributeType.Integer, 2);

                ExpressionUtils.SetAttrExp("DatumWidth", "DatumWidth", NXObject.AttributeType.Real);
                ExpressionUtils.SetAttrExp("DatumHeigth", "DatumHeigth", NXObject.AttributeType.Real);
                ExpressionUtils.SetAttrExp("EleHeight", "EleHeight", NXObject.AttributeType.Real);

                ExpressionUtils.CreateExp("moveZ=0", "Number");

                ExpressionUtils.CreateExp("xNCopies=PitchXNum", "Number");
                ExpressionUtils.CreateExp("yNCopies=PitchYNum", "Number");
                ExpressionUtils.CreateExp("xPitchDistance=PitchX", "Number");
                ExpressionUtils.CreateExp("yPitchDistance=-PitchY", "Number");
                ExpressionUtils.CreateExp("extrudePreparation=ceiling(PreparationZ-EleHeight-2)", "Number");
                if (zDatum)
                {
                    ExpressionUtils.CreateExp("moveBoxZ=0", "Number");
                    if (pre[0] >= pre[1])
                    {
                        ExpressionUtils.CreateExp("moveY=-(yNCopies-1)*yPitchDistance/2", "Number");
                        ExpressionUtils.CreateExp("moveX=-(xNCopies-2)*xPitchDistance/2", "Number");
                        ExpressionUtils.CreateExp("moveBoxX=-(xNCopies)*xPitchDistance/2", "Number");
                        ExpressionUtils.CreateExp("moveBoxY=0", "Number");
                    }
                    else
                    {
                        ExpressionUtils.CreateExp("moveX=-(xNCopies-1)*xPitchDistance/2", "Number");
                        ExpressionUtils.CreateExp("moveY=-(yNCopies-2)*yPitchDistance/2", "Number");
                        ExpressionUtils.CreateExp("moveBoxY=-(yNCopies)*yPitchDistance/2", "Number");
                        ExpressionUtils.CreateExp("moveBoxX=0", "Number");
                    }
                }
                else
                {
                    ExpressionUtils.CreateExp("moveX=-(xNCopies-1)*xPitchDistance/2", "Number");
                    ExpressionUtils.CreateExp("moveY=-(yNCopies-1)*yPitchDistance/2", "Number");
                }
                return(true);
            }
            catch (NXException ex)
            {
                ClassItem.WriteLogFile("创建表达式错误!" + ex.Message);
                return(false);
            }
        }
Ejemplo n.º 6
0
        private static void SetMoveExpForNoDatum(double anlge)
        {
            Expression moveXExp = ExpressionUtils.CreateExp("moveX=0", "Number");
            Expression moveYExp = ExpressionUtils.CreateExp("moveY=0", "Number");

            ExpressionUtils.CreateExp("moveZ=0", "Number");
            ExpressionUtils.EditExp(moveXExp, "-(xNCopies-1)*xPitchDistance/2");
            if (UMathUtils.IsEqual(anlge, Math.PI))
            {
                ExpressionUtils.EditExp(moveYExp, "(yNCopies-1)*yPitchDistance/2");
            }
            else
            {
                ExpressionUtils.EditExp(moveYExp, "-(yNCopies-1)*yPitchDistance/2");
            }
        }
Ejemplo n.º 7
0
        private static void SetMoveExpForZDatum(int[] pre, double anlge)
        {
            Expression moveXExp    = ExpressionUtils.CreateExp("moveX=0", "Number");
            Expression moveBoxXExp = ExpressionUtils.CreateExp("moveBoxX=0", "Number");
            Expression moveBoxYExp = ExpressionUtils.CreateExp("moveBoxY=0", "Number");
            Expression moveYExp    = ExpressionUtils.CreateExp("moveY=0", "Number");

            ExpressionUtils.CreateExp("moveZ=0", "Number");
            ExpressionUtils.CreateExp("moveBoxZ=0", "Number");
            if (pre[0] > pre[1])
            {
                ExpressionUtils.EditExp(moveXExp, "-(xNCopies-2)*xPitchDistance/2");
                ExpressionUtils.EditExp(moveBoxXExp, "-(xNCopies)*xPitchDistance/2");
                if (UMathUtils.IsEqual(anlge, Math.PI))
                {
                    ExpressionUtils.EditExp(moveYExp, "(yNCopies-1)*yPitchDistance/2");
                }
                else
                {
                    ExpressionUtils.EditExp(moveYExp, "-(yNCopies-1)*yPitchDistance/2");
                }
            }
            else
            {
                ExpressionUtils.EditExp(moveXExp, "-(xNCopies-1)*xPitchDistance/2");
                if (UMathUtils.IsEqual(anlge, Math.PI))
                {
                    ExpressionUtils.EditExp(moveYExp, "(yNCopies-2)*yPitchDistance/2");
                    ExpressionUtils.EditExp(moveBoxYExp, "(yNCopies)*yPitchDistance/2");
                }
                else
                {
                    ExpressionUtils.EditExp(moveYExp, "-(yNCopies-2)*yPitchDistance/2");
                    ExpressionUtils.EditExp(moveBoxYExp, "-(yNCopies)*yPitchDistance/2");
                }
            }
        }