Showing results 1 to 3 of 3

Thread: Changing a RGMRecipe Items value using VSTA

  1. #1
    Join Date
    07.07.2014
    Posts
    9

    Default Changing a RGMRecipe Items value using VSTA

    Hi,

    The method set_DynamicProperties of the RGMRecipeValue object does not seem to alter the value.

    I have written the following code;

            public void Macro_editRecipeItem()
            {
                String newRecipeName;
                newRecipeName = this.Variables().Item("rcpNewRecipeName").get_Value(0).ToString();
               // MessageBox.Show(newRecipeName);
    
                
    
    
                this.RGMGroups().Item("Amp Rose").RecipeItem(newRecipeName).ValueItem("rcpVar").set_DynProperties("Type", 2);
                
                //This has no effect on the recipe items value
                this.RGMGroups().Item("Amp Rose").RecipeItem(newRecipeName).ValueItem("rcpVar").set_DynProperties("Value", 10);
            
    
                //This shows the recipe variables correct value, so it proves the names are all correct
                MessageBox.Show(this.RGMGroups().Item("Amp Rose").RecipeItem(newRecipeName).ValueItem("rcpVar").get_DynProperties("Value").ToString());
    
            }

    Has anyone used this method successfully before?

    BR

    Chris

  2. #2
    Join Date
    20.08.2009
    Posts
    293

    Default AW: Changing a RGMRecipe Items value using VSTA

    Hi,

    altering the
    this.RGMGroups().Item("Amp Rose").RecipeItem(newRecipeName).ValueItem("rcpVar").set_DynProperties("Value", 10);
    directly won't work (don't ask my why exactly but there is something special about the RGM in the API which is not the same as for other zenon objects)

    You have to do it like this:
    (create variables/a copy of the RGM object and modify this copy/variables):

    public void Macro_AlterMyRGMRecipe()
    {
    zenOn.IRGMRecipeGroups zRGM;
    zRGM = this.RGMGroups();
    
    zenOn.IRGMRecipeGroup zRecipeGroup = zRGM.Item("groupName");
    zenOn.IRGMRecipe zRecipe = zRecipeGroup.RecipeItem("recipeName");
                           
    zRecipe.ValueItem("variableName").set_DynProperties("Value", 10);
    
    zRecipe.Save();
    zRecipeGroup.Save();
    }

    Tested it here in 7.11 and it works that way.

    Kind regards,
    Bernhard

  3. #3
    Join Date
    07.07.2014
    Posts
    9

    Default Re: Changing a RGMRecipe Items value using VSTA

    Thank you Bernhard, works perfectly.

Similar Threads

  1. Changing resolution without adaption?
    By kolath in forum zenon Supervisor
    Replies: 1
    Last Post: 10th July 2014, 03:29
  2. Replies: 5
    Last Post: 11th March 2014, 15:13
  3. display the load changing
    By shahramkh59 in forum zenon Supervisor
    Replies: 1
    Last Post: 1st February 2010, 00:35
  4. Replies: 0
    Last Post: 24th April 2008, 12:05
  5. Changing systemtime
    By markusw in forum Drivers
    Replies: 2
    Last Post: 10th September 2007, 21:25

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •