//public int NewNo { get; set; }

        // Display Info of the RFEM Objects on Panels
        // Parameters are separated by ";". The component split text can be used to break the string down into a list.
        public override string ToString()
        {
            return(string.Format($"RFEM-LineLoad;No:{No};LoadCase:{LoadCase};" +
                                 $"F1:{Magnitude1.ToString("0.00")}[kN/m]|[kN];F2:{Magnitude2.ToString("0.00")}[kN/m]|[m]|[-];F3:{Magnitude3.ToString("0.00")}[kN/m];" +
                                 $"t1:{DistanceA.ToString("0.00")}[-];t2:{DistanceB.ToString("0.00")}[-];" +
                                 $"OverTotalLength:{OverTotalLength.ToString()};RelativeDistances:{RelativeDistances.ToString()};" +
                                 $"LoadArray:{LoadArray.ToLabelString()}" +
                                 $"LoadType:{LoadType.ToString()};LoadDistType:{LoadDistType.ToString()};LoadDirType:{LoadDirType.ToString()};LoadRefType:{LoadRefType.ToString()};" +
                                 $"LineList:{((LineList == "") ? "-" : LineList)};IsValid:{IsValid};ID:{((ID == "") ? "-" : ID)};Tag:{((Tag == "") ? "-" : Tag)};" +
                                 $"ToModify:{ToModify};ToDelete:{ToDelete};Comment:{((Comment == "") ? "-" : Comment)};"));
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            RunConfig runConfig;

            if (!TryParseArguments(args, out runConfig))
            {
                Usage();
                return;
            }

            var code = File.ReadAllText(args[0]);

            var pageState = new GraphicsState();

            var stack     = new LinearList <IOperation>();
            var execStack = new LinearList <IOperation>();
            var dictStack = new LinearList <IDictionary <string, IOperation> >();

            var system = new Dictionary <string, IOperation>();

            system["add"]    = new Add();
            system["sub"]    = new Substract();
            system["mul"]    = new Multiplicate();
            system["div"]    = new Divide();
            system["mod"]    = new Mod();
            system["def"]    = new Define();
            system["for"]    = new For();
            system["dup"]    = new Duplicate();
            system["index"]  = new Index();
            system["pop"]    = new Pop();
            system["exch"]   = new Exchange();
            system["repeat"] = new Repeat();
            system["array"]  = new EmptyArray();
            system["astore"] = new LoadArray();
            system["rand"]   = new Rand();
            system["cvi"]    = new ConvertToInteger();
            system["copy"]   = new Copy();
            system["roll"]   = new Roll();
            system["get"]    = new ArrayGet();
            system["put"]    = new ArrayPut();
            system["ne"]     = new NotEqual();
            system["eq"]     = new Equal();
            system["or"]     = new Or();
            system["ifelse"] = new IfElse();
            system["if"]     = new If();
            system["neg"]    = new Neg();
            system["not"]    = new Not();
            system["sqrt"]   = new Sqrt();
            system["lt"]     = new LessThan();
            system["ge"]     = new GreaterOrEqualThan();

            dictStack.Push(system);


            var graphics = new Dictionary <string, IOperation>();

            graphics["newpath"]      = new NewPath(pageState);
            graphics["closepath"]    = new ClosePath(pageState);
            graphics["fillpath"]     = new FillPath(pageState);
            graphics["setgray"]      = new SetGray(pageState);
            graphics["setrgbcolor"]  = new SetRGB(pageState);
            graphics["setlinewidth"] = new SetLineWidth(pageState);
            graphics["fill"]         = new FillPath(pageState);
            graphics["showpage"]     = new ShowPage(pageState);
            graphics["moveto"]       = new MoveTo(pageState);
            graphics["lineto"]       = new LineTo(pageState);
            graphics["rlineto"]      = new RelativeLineTo(pageState);
            graphics["gsave"]        = new SaveGraphicsState(pageState);
            graphics["grestore"]     = new RestoreGraphicsState(pageState);
            graphics["stroke"]       = new StrokePath(pageState);
            graphics["curveto"]      = new CurveTo(pageState);
            graphics["arc"]          = new Arc(pageState);

            dictStack.Push(graphics);

            dictStack.Push(new Dictionary <string, IOperation>());

            //execStack.Push(start);


            CodeParser.LoadCode(execStack,
                                @"
/findfont { pop (somefont) } def
/scalefont { exch pop } def
/setfont { pop } def
/setlinecap { pop } def
/srand { pop } def
");

            CodeParser.LoadCode(execStack, code);

            var state = new PreScriptState(stack, execStack, dictStack);

            while (execStack.Count > 0)
            {
                var operation = execStack.Pop();
                operation.Process(state);
            }
        }