Ejemplo n.º 1
0
        public static Executable fromId(STEPNCLib.Finder finder, long wpid)
        {
            Executable ret;

            if (finder.IsWorkplan(wpid))
            {
                WorkplanExecutable wpe = new WorkplanExecutable();
                wpe.children = finder.GetNestedExecutableAll(wpid).Select((long id) =>
                {
                    return(ExecutableFactory.fromId(finder, id));
                }).ToList <Executable>();
                ret = wpe;
            }
            else if (finder.IsSelective(wpid))
            {
                SelectiveExecutable se = new SelectiveExecutable();
                se.children = finder.GetNestedExecutableAll(wpid).Select((long id) =>
                {
                    return(ExecutableFactory.fromId(finder, id));
                }).ToList <Executable>();
                ret = se;
            }
            else
            {
                ret = new GenericExecutable();
            }

            ret.id   = wpid;
            ret.name = finder.GetExecutableName(wpid);

            return(ret);
        }
Ejemplo n.º 2
0
        public static void generateFromAnalysis(Analysis.Analysis analysis, String basePath, String outputPath)
        {
            List <MTConnectEvent> timeline = analysis.timeline;

            Log.Write("Generating StepNC Data");
            STEPNCLib.AptStepMaker apt  = new STEPNCLib.AptStepMaker();
            STEPNCLib.Finder       find = new STEPNCLib.Finder();

            Log.Write("Using template StepNC file " + basePath);
            apt.Open238(basePath);
            find.Open238(basePath);

            long wp_id = find.GetMainWorkplan();

            apt.NestWorkplanAfter("Workplan for MTConnect results", find.GetWorkplanExecutableCount(wp_id) + 1, wp_id);

            apt.Workingstep("testing");

            apt.LoadTool(101);
            apt.Rapid();

            // Add all the path positions
            foreach (PathPosition pp in timeline)
            {
                apt.GoToXYZ("seq" + pp.sequence, pp.coords.x * mmtoinch, pp.coords.y * mmtoinch, pp.coords.z * mmtoinch);
            }
            apt.SaveAsModules(outputPath);
            Log.Write("StepNC Written to " + outputPath);
        }
        static void Main(string[] args)
        {
            // Create a trivial STEP-NC file
            STEPNCLib.Finder Find = new STEPNCLib.Finder();
            string file = "v14_IMTS_HARDMOLDY.stpnc";

            Find.Open238(file);

            long wp_id = Find.GetMainWorkplan();
            long tl_count = Find.GetWorkplanToolCount(wp_id);

            Console.WriteLine("There are {0} tools", tl_count);

            for (int I = 0; I < tl_count; I++)
            {
            long tl_id = Find.GetWorkplanToolNext(wp_id,I);
            Boolean has_diam;
            Boolean has_length;
            Boolean has_radius;
            double tl_diam = Find.GetToolDiameter(tl_id, out has_diam);
            double tl_length = Find.GetToolLength(tl_id, out has_length);
            double tl_rad = Find.GetToolCornerRadius(tl_id, out has_radius);
            Console.WriteLine("Tool with tool id: {0} has diameter {1} and length {2} and radius {3}", tl_id, tl_diam, tl_length, tl_rad);
            }
            Console.ReadLine();
        }
Ejemplo n.º 4
0
 public StepInterface(string path)
 {
     apt = new STEPNCLib.AptStepMaker();
     apt.Open238(path);
     finder = new STEPNCLib.Finder();
     finder.Open238(path);
     STEPNCLib.MachineState.Init();
     machinestate = new STEPNCLib.MachineState(path);
 }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            STEPNCLib.Finder Find = new STEPNCLib.Finder();
            STEPNCLib.AptStepMaker APT = new STEPNCLib.AptStepMaker();
            StringBuilder builder = new StringBuilder();
            String out_dirFile = args[0];
            String input_file = args[1];

            APT.Open238(input_file);
            Find.Open238(input_file);

            long wp_id = Find.GetMainWorkplan();
            int depth = 0;
            bool last = false;
            long count = 0;

            String uu = APT.SetUUID_if_not_set(wp_id);
            //System.Console.WriteLine("Main Workplan name " + Find.GetExecutableName(wp_id) + " has UUID: " + uu);
            Mark_plan(wp_id, Find, APT, builder, depth, last, ref count);
            Mark_pieces(Find, APT, builder);
            Mark_tools(Find, APT, builder);
            Mark_technologies(Find, APT, builder);

            APT.SaveAsModules("hardmoldy_IMTS_signed_uuid.stpnc");

            string output = builder.ToString();
            if (!Directory.Exists(out_dirFile)) //See if the path exists
            Directory.CreateDirectory(Path.GetDirectoryName(out_dirFile)); //Create if not

            using (StreamWriter out_file = //StreamWrite output to file
                new StreamWriter(File.Open(out_dirFile, FileMode.Create)))
            {
            out_file.WriteLine(output);
            }
            //Console.ReadLine();
        }