gunnaraherman

MrPLC Member
  • Content count

    23
  • Joined

  • Last visited

Everything posted by gunnaraherman

  1. Hello, I am looking for a way to programatically select a recipe. Any time that a recipe is change or saved, the recipe viewer object always resets its view and selects the first recipe. This will lead to possibly writing the wrong recipe to the controller, as well as frustrate the user if they have to scroll through a hundred items to find the recipe again. I looked at the VB functions, but the only one I could find that was close was the .SelectedRecipe, which is a read only. I am using Sysmac Studio v1.1.7, and an NA5 HMI. Any help would be appreciated.
  2. I found this video to be helpful when I was working through recipes.  https://www.youtube.com/watch?v=8gqnYP5AOps   
  3. Enumerations in Recipes

    Apologies for the late response. I was traveling.    Thanks for the example. I'll need to update Sysmac Studio first to view it, but I'm sure it'll shed light on this issue and future issues.    In the meantime, I was able to create an ingredient that was uneditable and not visible within the recipe viewer object, and map the variable to a group of radio buttons. The only thing extra I needed to do was call the VB function to set the recipe ingredient before I saved the recipe.    Thanks for everyone's help.
  4. Enumerations in Recipes

    Hello,   Is there a way to limit the input of an ingredient value, possibly by use of an Enum?  For example, I have an ingredient called Press_Speed. I want the values to be either Normal, Slow_1x, Slow_2x, or Slow_3x. On the PLC these values are interpreted as numbers. Can I limit the input to the String representation of the Enum?   I'm using the NA series HMI with Sysmac Studio. 
  5. Enumerations in Recipes

    Up until now, the canned recipe control has worked well for me, although now that my needs have changed, I may need something a little more versatile. Do you have an example of a custom built, more flexible recipe editor?
  6. Enumerations in Recipes

    That has more to do with data validation which is different.  In the same way that a Boolean data type will give you the option of a different keypad with the options True and False buttons, I'm looking for a way to allow users to select the Enumerated values, with the ability to enter its String representation on the keypad (Normal, Slow etc), not its numerical value (1,2, etc). Digging into this, it appears there's no way to accomplish this.   
  7. Programatically Select Recipe

    I don't think so. I opened a new project and added an HMI with a recipe viewer object and it worked in simulation mode. I've attached the project so you can see yourself.  Make sure the DataDisplay type is set to String, not Numeric.    Hope this helps. test.smc2
  8. Programatically Select Recipe

    If you're using the DownloadRecipe subroutine, place the variable assignment in there. So it should look like  Public Sub DownloadRecipe WriteRecipeToController(RecipeViewer0.SelectedTemplate, RecipeViewer0.SelectedRecipe) NJ1_HMI_Loaded_Program = RecipeViewer0.SelectedRecipe End Sub It would then seem like you don't need the WriteSelectedRecipe subroutine.  As far as creating a new recipe, I would start a new topic to keep subjects and comments organized. 
  9. Programatically Select Recipe

    This line assigns the selected recipe to a global string variable: NJ1_HMI_Loaded_Program = rcpMold.SelectedRecipe In your case it should be: <your_global_string_variable> = RecipeViewer0.SelectedRecipe  
  10. Programatically Select Recipe

    The DownloadRecipe appears to be fine. I tested it in Simulation mode and it worked for me. I've attached an image of the value in the watch window. For your DataDisplay, just make sure that the variable is entered as the expression (attached image).
  11. Programatically Select Recipe

    For now you can remove the Try Catch statement and the Global_Sub references. I was using those as well as the Global_Sub routines to communicate success or errors. If you simply have this inside your subroutine, it should work: Dim rcpSelectedTemplate As String = GetSelectedRecipeTemplate([name_of_page], [name_of_recipeviewer_object]) Dim rcpSelectedRcp As String = GetSelectedRecipe([name_of_page], [name_of_recipeviewer_object]) WriteRecipeToController(rcpSelectedTemplate, rcpSelectedRcp) NJ1_HMI_Loaded_Program = rcpSelectedRcp Where NJ1_HMI_Loaded Program is a global string variable.  Use the Watch window or a data display to view the value of the Loaded Program variable.
  12. Programatically Select Recipe

    You should be able to get this value even in Simulation mode. I tested it myself and was able to get it. In the above code, these two lines get the selected recipe template and selected recipe, make sure the parameters are correct. Dim rcpSelectedTemplate As String = GetSelectedRecipeTemplate("Main", "rcpMold") Dim rcpSelectedRcp As String = GetSelectedRecipe("Main", "rcpMold") "Main" is the page name, and "rcpMold" is the name of the recipe viewer object. I find that looking up the function in Help -> Instruction Help is very helpful in answering any questions about it.
  13. Programatically Select Recipe

    I have this VB code which fires every time I write a new recipe: Sub WriteSelectedRecipe() Try Dim rcpSelectedTemplate As String = GetSelectedRecipeTemplate("Main", "rcpMold") Dim rcpSelectedRcp As String = GetSelectedRecipe("Main", "rcpMold") WriteRecipeToController(rcpSelectedTemplate, rcpSelectedRcp) NJ1_HMI_Loaded_Program = rcpSelectedRcp 'Selected reciped gets set here Global_Sub.ShowSuccessPage("Program '" & rcpSelectedRcp & "' has been written.") Catch ex As Exception Global_sub.ShowErrorPage(ex.message) End Try End Sub I created a variable named  NJ1_HMI_Loaded_Program which is set in the above code. You can then use a Data Display control and set the Expression as NJ1_HMI_Loaded_Program. Hope this helps.       
  14. Programatically Select Recipe

    Could you explain this more? Specifically how to set it as fixed parameters in my scripts. You said the .SelectedItem is for the recipe viewer, which is where I would like to programmatically select the recipe. However, I do understand that the method is read only, and not used for setting.  In my mind, what I think I need to do is before each action that resets the selected recipe is store the recipe in a variable. Then at the end of the Sub, do something like 'rcpViewer.selectedRecipe = varRecipe' - just not a read only method.  Thanks for the help. 
  15. Dialog File Browsing

    Apologies for the delayed response.   I can share what I have once it's finalized, but can't take any credit for it. The original IAG that I downloaded is here listed as  Memory File Manager SD / USB / FTP Filemanager V2 https://www.support-omron.fr/Prog_HMI.php I just stripped out the right side listbox and dropdown and minor other differences.     
  16. Dialog File Browsing

    Hello, I am looking for a way to use the OpenFileDialog in VB to be able to select a recipe file to import. I read this forum: and thought that maybe I could access the OpenFileDialog function from the code, but System.Windows.Forms namespace is unavailable.  Is there any other way to access the dialog box to let the user select a file? I am using Sysmac Studio with an NA5 series HMI. Thank you for your help.
  17. Dialog File Browsing

    After reading through this post I was able to find a File Manager IAG that I was able to use.  The site has a lot of helpful examples that I think will prove useful in the future. 
  18. Hello, I am using an NJ301 PLC with an NA series HMI. I am communicating to the PLC via FINS protocol using the DotNet FINS UDP application by Jay Anthony found under the downloads section. I am finding that when I write a string to an address, the bytes order are reversed. For example,  I am writing the string 'Test' to variable 'FINS_String', which is a String data type at memory address D20. My FINS command is the following: 010282001400000254657374 0102: Write 82: Data Memory 001400: Address 20 0002: Write 2 words 54: T 65: e 73: s 74: t The value that appears on the HMI and in the watch window is 'eTts'. If I write 65547473 (eTts) as my command, it appears correctly as 'Test' on my HMI. I debugged the application and I see that the byte array is being sent in the correct order, so I'm not sure what the matter is. I can't imagine that to pass a string through FINS protocol the hex values need to be switched every time.  Any help would be appreciated. Thank you for your time.    
  19. ASCII Characters Reversed When Using FINS

    After looking into the issue and Endianness, it appears that was the issue. Thank you for shedding light on this issue. I'm rather new to PLC's and was unaware of it.
  20. Hello, I'm pretty new to Sysmac Studio and have a question regarding displaying an image on the HMI. We have a machine that uses molds to create parts. For each mold, there is a recipe storing information pertinent to it. I would like to be able to store either a ResourceID or an image path as an ingredient, and load an image upon recipe change. Using a subroutine, I was hoping to do it like this: imgDrawing.ResourceID = GetRecipeIngredientValue("rcpMold", "SelectedRecipe", "ResourceID") But I am unable to access the ResourceID of the Image.  Is there anyway to be able to dynamically change an image upon recipe change, based off of an ingredient? Any help would be appreciated. 
  21. NA5 - Dynamically Change Image From Recipe

    Apologies, I should have posted that first. I am using an NA5-9W001S screen with a NJ301-1200 PLC. 
  22. NA5 - Dynamically Change Image From Recipe

    Thank you for the reply. Do you know if there is any other way to display an image based off a recipe? The only other idea that I had was to add all the images to the screen and change the visibility based off the current ingredient, but this seemed a bit cumbersome.