Getting and Setting Values in Standard Recipes

Getting and Setting Values in Standard Recipes

What would be the best way to get/set values in the Standard Recipes? I have a Standard Recipe Collection which includes pipe "Size" and "Schedule" entries and if these match my target values, I want to set a "Selected" value as true. Please see the draft below. I am using the GetDynamicProperties method, but I am not sure that is the right way to do it. [SIZE=3][FONT=Arial][FONT=monospace] IStandardRecipeCollection standardRecipes;[/FONT][/FONT] [FONT=Arial][FONT=monospace] // The Standard Recipe Collection is extracted from the context. [/FONT][/FONT] [FONT=Arial][FONT=monospace]foreach (IStandardRecipe recipe in standardRecipes) { bool match = false;[/FONT][/FONT] [FONT=Arial][FONT=monospace] try { Int32 sched = Int32.Parse(recipe.GetDynamicProperty("Pipe_Schedule").ToString()); Double diameter = Double.Parse(recipe.GetDynamicProperty("Size_Of_Pipe").ToString());[/FONT][/FONT] [FONT=Arial][FONT=monospace] if (Int32.Parse(recipeFilter.mSchedule) == sched && Double.Parse(recipeFilter.mDiameter) == diameter) { match = true; }[/FONT][/FONT] [FONT=Arial][FONT=monospace] recipe.SetDynamicProperty("Selected", match); } catch () } [/FONT][/FONT] [/SIZE]Thanks

This is a migrated post! Originally posted on 11.09.2019 by user EhsanMehr. Please be aware that information can be outdated.