Ejemplo n.º 1
0
    public Program(string name, RobotSystem robotSystem, IEnumerable <IToolpath> toolpaths, Commands.Group?initCommands = null, IEnumerable <int>?multiFileIndices = null, double stepSize = 1.0)
    {
        RobotSystem  = robotSystem;
        InitCommands = initCommands?.Flatten().ToList() ?? new List <Command>(0);
        var targets = CreateCellTargets(toolpaths);

        if (targets.Count > 0)
        {
            var checkProgram = new CheckProgram(this, targets, stepSize);
            _simulation = new Simulation(this, checkProgram.Keyframes);
            targets     = checkProgram.FixedTargets;
        }

        Targets = targets;

        Name = name;
        CheckName(name, robotSystem);
        MultiFileIndices = FixMultiFileIndices(multiFileIndices, Targets.Count);

        if (Errors.Count == 0)
        {
            Code = RobotSystem.Code(this);
        }
    }