コード例 #1
0
        //Marks a Workingstep with attributes: ["name" (if available), "base_time", "opt_time" (if available), "distance"]
        static void Mark_step(long ws_id, STEPNCLib.Finder Find, STEPNCLib.AptStepMaker APT, StringBuilder builder, int depth, bool last, ref long count)
        {
            string name = Find.GetWorkingstepName2(ws_id);
            double base_time = Find.GetExecutableBaseTime(ws_id);
            double opt_time = Find.GetExecutableOptimizedTime(ws_id);
            double distance = Find.GetExecutableDistance(ws_id);
            for (int i = 0; i < depth; i++)
            builder.Append("\t");
            builder.Append("{\"working_step\": {");
            if (name != "")
            {
            builder.Append("\"name\": \"");
            builder.Append(name);
            builder.Append("\", ");
            }
            builder.Append("\"base_time\": ");
            builder.Append(base_time);
            builder.Append(", ");
            if (opt_time != base_time)
            {
            builder.Append("\"opt_time\": ");
            builder.Append(opt_time);
            builder.Append(", ");
            }
            builder.Append("\"distance\": ");
            builder.Append(distance);
            builder.Append(", ");

            List<long> paths = Find.GetWorkingstepPathAll(ws_id);
            builder.Append("\"toolpaths\" : [\n");
            bool last2 = false;
            for(int i = 0; i < paths.Count; i++){
            long tp_id = paths[i];
            if(i == (paths.Count - 1))
                last2 = true;
            else
                last2 = false;
            String uu = APT.SetUUID_if_not_set(tp_id);
            decode_tp(Find, builder, tp_id, depth + 1, last2, ref count);
            }

            if (last)
            {
            builder.Append(" ]}}\n");
            count = count + 1;
            }
            else
            builder.Append(" ]}},\n");
        }