hexagon logo

Automated execution of several consecutive programs

Hi guys.
I would like to know how i can automate the execution of several consecutive programs and which software i can do it easily.
Maybe somebody can share some code of vba or c+.
the goal is to run a program and after completion execute the next until finish all programs that i need. I will use an external alignment in every program in order to mesure all parts that i have fixed on the cmm table.
Thank you

Enviado desde mi SM-G928F mediante Tapatalk
Parents
  • Basic Script

    This might help.
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Dim PCDApp, PCDPartPrograms, PCDPartProgram[/FONT][/COLOR][COLOR=#454545][FONT=UICTFontTextStyleBody]
    [/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDApp = CreateObject("PCDLRN.Application")[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDPartPrograms = PCDApp.PartPrograms[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] PCDApp.Visible = True[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody] PCDPartPrograms.Open "Z:\test1.PRG", "CMM1"[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDPartProgram = PCDApp.ActivePartProgram[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] 'msgbox "This will start the execution of the partprogram!"[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody] PCDPartProgram.Execute[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] ' PC-DMIS executes the partprogram[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] PCDPartProgram.Close[/FONT][/COLOR][COLOR=#454545][FONT=UICTFontTextStyleBody]
    [/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody] ' PC-DMIS closes and saves the partprogram[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody]PCDPartPrograms.Open "Z:\test2.PRG", "CMM1"[/FONT][/COLOR][COLOR=#454545][FONT=UICTFontTextStyleBody]
    [/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDPartProgram = PCDApp.ActivePartProgram[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] 'msgbox "This will start the execution of the partprogram!"[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody] PCDPartProgram.Execute[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] ' PC-DMIS executes the partprogram[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] PCDPartProgram.Close[/FONT][/COLOR][COLOR=#454545][FONT=UICTFontTextStyleBody]
    [/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody] ' PC-DMIS closes and saves the partprogram[/FONT][/COLOR][COLOR=#454545][FONT=UICTFontTextStyleBody]
    [/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]' Cleanup[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDPartProgram = nothing[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDPartPrograms = nothing[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDApp = nothing
    [/FONT][/COLOR]


    hi

    I have stolen your code and all works fine apart from when I try and execute the code without pcdmis being open, it starts in offline mode. When I start it with Pcdmis open all works fine. Do you know the reasoning behind this? Do I have to start pcdmis before executing the code.

    I am using a button in an excel sheet to execute the code by the way.

    Also very new to trying this kind of stuff so there may be a reason why it is doing it, running 2012MR1
Reply
  • Basic Script

    This might help.
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Dim PCDApp, PCDPartPrograms, PCDPartProgram[/FONT][/COLOR][COLOR=#454545][FONT=UICTFontTextStyleBody]
    [/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDApp = CreateObject("PCDLRN.Application")[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDPartPrograms = PCDApp.PartPrograms[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] PCDApp.Visible = True[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody] PCDPartPrograms.Open "Z:\test1.PRG", "CMM1"[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDPartProgram = PCDApp.ActivePartProgram[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] 'msgbox "This will start the execution of the partprogram!"[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody] PCDPartProgram.Execute[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] ' PC-DMIS executes the partprogram[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] PCDPartProgram.Close[/FONT][/COLOR][COLOR=#454545][FONT=UICTFontTextStyleBody]
    [/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody] ' PC-DMIS closes and saves the partprogram[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody]PCDPartPrograms.Open "Z:\test2.PRG", "CMM1"[/FONT][/COLOR][COLOR=#454545][FONT=UICTFontTextStyleBody]
    [/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDPartProgram = PCDApp.ActivePartProgram[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] 'msgbox "This will start the execution of the partprogram!"[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody] PCDPartProgram.Execute[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] ' PC-DMIS executes the partprogram[/FONT][/COLOR]
    
    [COLOR=#454545][FONT=UICTFontTextStyleBody] PCDPartProgram.Close[/FONT][/COLOR][COLOR=#454545][FONT=UICTFontTextStyleBody]
    [/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody] ' PC-DMIS closes and saves the partprogram[/FONT][/COLOR][COLOR=#454545][FONT=UICTFontTextStyleBody]
    [/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]' Cleanup[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDPartProgram = nothing[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDPartPrograms = nothing[/FONT][/COLOR]
    [COLOR=#454545][FONT=UICTFontTextStyleBody]Set PCDApp = nothing
    [/FONT][/COLOR]


    hi

    I have stolen your code and all works fine apart from when I try and execute the code without pcdmis being open, it starts in offline mode. When I start it with Pcdmis open all works fine. Do you know the reasoning behind this? Do I have to start pcdmis before executing the code.

    I am using a button in an excel sheet to execute the code by the way.

    Also very new to trying this kind of stuff so there may be a reason why it is doing it, running 2012MR1
Children
No Data