Exemplo n.º 1
0
        // get a design rule value e.g. polygon clearance
        static double GetRuleValue(PCBObject Obj, string kind, string name)
        {
            var P = new Parser();

            foreach (var RuleKind in RuleKindsL)
            {
                if (RuleKind.Kind == kind)
                {
                    foreach (var Rule in RuleKind.Rules)
                    {
                        if (P.Eval(Obj, P.ParseAltiumExpr(Rule.Scope1Expression)) && P.Eval(Obj, P.ParseAltiumExpr(Rule.Scope2Expression)))
                        {
                            return(Rule.Value);
                        }
                    }
                }
            }
            // not found return default value TODO find out what proper default value is
            return(0.1);

            /*
             * foreach (var Rule in RulesL)
             * {
             *  if ((Rule.RuleKind == kind) && (Rule.Name == name))
             *  {
             *      return Rule.Value;
             *  }
             * }
             */
            return(0);
        }
Exemplo n.º 2
0
 public override bool Eval(PCBObject Obj)
 {
     if (LeftExpression.Eval(Obj) == true)
     {
         return(true);
     }
     return(RightExpression.Eval(Obj));
 }
Exemplo n.º 3
0
                public override bool Eval(PCBObject Obj)
                {
                    switch (_roleName)
                    {
                    case "All":                return(Obj.All());

                    case "IsArc":              return(Obj.IsArc());

                    case "IsClass":             return(Obj.IsClass());

                    case "IsComponentArc":      return(Obj.IsComponentArc());

                    case "IsComponentFillc":    return(Obj.IsComponentFill());

                    case "IsComponentPad":      return(Obj.IsComponentPad());

                    case "IsComponentTrack":    return(Obj.IsComponentTrack());

                    case "IsConnection":        return(Obj.IsConnection());

                    case "IsCoordinate":        return(Obj.IsCoordinate());

                    case "IsCopperRegion":      return(Obj.IsCopperRegion());

                    case "IsCutoutRegion":      return(Obj.IsCutoutRegion());

                    case "IsDatumDimension":    return(Obj.IsDatumDimension());

                    case "IsDesignator":        return(Obj.IsDesignator());

                    case "IsComment":           return(Obj.IsComment());

                    case "IsFill":              return(Obj.IsFill());

                    case "IsPad":               return(Obj.IsPad());

                    case "IsPoly":              return(Obj.IsPoly());

                    case "IsPolygon":           return(Obj.IsPolygon());

                    case "IsRegion":            return(Obj.IsRegion());

                    case "IsSplitPlane":        return(Obj.IsSplitPlane());

                    case "IsText":              return(Obj.IsText());

                    case "IsTrack":             return(Obj.IsTrack());

                    case "IsVia":               return(Obj.IsVia());

                    case "InComponent":         return(Obj.InComponent(_roleParam));
                    }
                    return(false); // principal.IsInRole(RoleName);
                }
Exemplo n.º 4
0
        public PCBObject getPCBWithId(int id)
        {
            for (int i = 0; i < PCB.Count(); i++)
            {
                if (PCB[i].id == id)
                {
                    return(PCB[i]);
                }
            }
            PCBObject error = new PCBObject();

            return(error);
        }
Exemplo n.º 5
0
 public void add(PCBObject x)
 {
     PCB.Add(x);
 }
Exemplo n.º 6
0
 public bool Eval(PCBObject Obj, Node Expr)
 {
     return(Expr.Eval(Obj));
 }
Exemplo n.º 7
0
 public override bool Eval(PCBObject Obj)
 {
     return(LeftExpression.EvalExpr(Obj) == RightExpression.EvalExpr(Obj));
 }
Exemplo n.º 8
0
 public virtual double EvalExpr(PCBObject Obj)
 {
     return(0);
 }
Exemplo n.º 9
0
 public override double EvalExpr(PCBObject Obj)
 {
     return(0); // LeftExpression.EvalExpr(Obj) != RightExpression.EvalExpr(Obj);
 }
Exemplo n.º 10
0
 public abstract bool Eval(PCBObject Obj);
Exemplo n.º 11
0
 public override bool Eval(PCBObject Obj)
 {
     return(!Expression.Eval(Obj));
 }