Your Products have been synced, click here to refresh
I put this in the script. It will return the right values but it also wants to redraw the screen
So I get the screen twice.
If Dialog (Dlg1) = "-1" Then V3 = "OK" Else V3 = "0" End If
I think what you have going on here is that you have called the Dialog(Dlg1) instance twice in your program so it will open it twice. Once for the Button = Dialog(Dlg1) command and once for your if..then loop
'Button = Dialog (Dlg1) comment out If Dialog (Dlg1) = "-1" Then V3 = "OK" Else V3 = "Cancel" End If
If the "ok" is selected this works fine and updates the pcdims program variable. Stays in the testit$ loop if "cancel" is selected. You have to select your choices on the menu and select "ok". Is there away to update "V3" in the above example during the .bas file avoiding the testit$ loop and changing the variable in the pcdims program?
Bill
Not sure how to pass it back to the pcd program?
If[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dialog[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (Dlg1) = "-1" [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE][/COLOR][/SIZE] [SIZE=2]V10 = "OK"[/SIZE] [SIZE=2]Else[/SIZE] [SIZE=2]V10 = "Cancel"[/SIZE] Dim Cmds As Object Dim Cmd As Object Set Cmds = PCDMISPart.Commands For Each Cmd In Cmds If Cmd.Type = ASSIGNMENT Then If Cmd.GetText(DEST_EXPR, 0) = "BUTTON" Then bln = Cmd.PutText(V10, SRC_EXPR, 0) Cmd.ReDraw End If Next Cmd [SIZE=2]Exit Sub[/SIZE] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE] [/COLOR][/SIZE]
Sub main () 'Setup maching And assembly traceability 'Declare variables Dim PCDMISapp As Object Dim PCDMISPart As Object 'Get a pointer To the application Set PCDMISApp = CreateObject("PCDLRN.Application") 'Get the active part program (Assumes PC-DMIS is already running ' With an Open part program...) Set PCDMISPart = PCDMISApp.ActivePartProgram 'CREATE THE LIST OF MACHINE NUMBERS Dim CustList$ (41) For cl = 0 To 40 CustList(ml) = "Cust " & cl Next cl CustList$(0) = "R H Sheppard" CustList$(1) = "Parker" CustList$(2) = "Rexroth" CustList$(3) = "Husco" CustList$(4) = "Denison" CustList$(5) = "N/A" CustList$(6) = "N/A" 'CREATE THE LIST OF PALLET NUMBERS Dim PalList$(31) For pl = 0 To 6 PalList(pl) = "Pallet " & pl Next pl PalList$(0) = "Carl B." PalList$(1) = "Jim H." PalList$(2) = "Tony M." PalList$(3) = "Jeff P." PalList$(4) = "Ken S" PalList$(5) = "Bill A." PalList$(6) = "Other" 'CREATE THE REASON For CHECK LIST Dim ReasonList$(10) ReasonList (0) = "Pattern" ReasonList (1) = "Core Box" ReasonList (2) = "Core" ReasonList (3) = "Cast" ReasonList (4) = "Plastic" ReasonList (5) = "Machined" ReasonList (6) = "Capability Study" ReasonList (7) = "Dispositon" ReasonList (8) = "Engineering" ReasonList (9) = "Other" Dim OperatorList$(10) OperatorList (0) = "Tom" OperatorList (1) = "John" OperatorList (2) = "N/A" 'CREATE THE LIST OF SHIFTS Dim SHIFT$(3) 'SHIFT(0) = "First Shift" 'SHIFT(1) = "Second Shift" 'SHIFT(2) = "Third Shift" ' '--------------------------------------------------------------------------------- 'BELOW: PULL a String variable from the PC-DMIS program '------------------------------------------------------------------------------------ Dim OptVal As Integer Dim SSEL As String Dim Capno As String Dim Answer As String Dim CMMID As String Dim SETID As String Dim objCMM As Object Set objCMM = PCDMISPart.GetVariableValue("SETID") CMMID = objCMM.StringValue 'CREATE THE Dialog BOX REDO1: Begin Dialog TraceDialog 230, 280, "Excel Header Info: " OptionGroup.Group_1 OptionButton 15, 15, 48, 12, "& First" OptionButton 15, 25, 48, 12, "& Second" OptionButton 15, 35, 48, 12, "& Third" GroupBox 5,5,60,55,"Shift",.GroupBox1 GroupBox 70,5,60,55,"Inspector",.GroupBox ComboBox 70,15,50,35,operatorlist$( ),.CmboBox6 ComboBox 15,80,70,40, CustList$( ),.CmboBox1 ComboBox 90,80,50,40, PalList$( ),.CmboBox3 ComboBox 145,80,70,40, ReasonList$( ),.CmboBox4 'CheckBox 125,50,70,10,"&Manual",.ChkBox1 'Text 125,20,80,10,.CMMID 'Text 125,40,80,10,"Manual Alignment: " Text 15,70,40,10,"Customer:" Text 144,70,70,10,"Inspection Type:" Text 90,70,50,10,"Requested By:" Text 15,215,46,20,"COMMENT:" TextBox 15,225,200,25,.TextBox2 Text 15,190,46,10,"Work Order:" TextBox 15,200,200,15,.TextBox66 Text 15,130,46,10,"Part Number:" TextBox 15,140,90,15,.TextBox77 Text 15,160,76,10,"Part Discription:" TextBox 15,170,200,15,.TextBox88 Text 135,130,46,10,"Rev Level:" TextBox 135,140,60,15,.TextBox33 Text 145,5,60,20,"Cast Date:" TextBox 145,15,60,15,.TextBox44 Text 145,35,60,20,"Foundry:" TextBox 145,45,60,15,.TextBox55 OKBUTTON 12, 260, 40, 15 CancelButton 72, 260, 40, 15 End Dialog 'ADD DATA Dim Dlg1 As TraceDialog Dim Dgl2 As GroupBox1 Dim Testit As String 'Button = Dialog (Dlg1) If Dialog (Dlg1) = "-1" Then V3 = "OK" Else V3 = "Cancel" If V3 = "Cancel" Then GoTo CPRESS End If End If OptVal = Dlg1.Group_1 'MAKE SURE ALL THE DATA IS INCLUDED Or Set DEFAULTS If OptVal = 0 Then SSEL = "First" End If If OptVal = 1 Then SSEL = "Second" End If If OptVal = 2 Then SSEL = "Third" End If If OptVal = 3 Then SSEL = "N/A" End If Testit$ = SSEL If Testit$ = "Third" Then MsgBox "Please select a Shift" GoTo redo1 End If NEWNUM: If Testit$ = "Capability Study" Then Capno = InputBox( "Please enter a Sequence Number") If val(Capno)<1 Or val(Capno)>999 Then GoTo NEWNUM End If End If Testit$ = Dlg1.TextBox2 If Testit$ = "" Then Dlg1.TextBox2 = "None" End If 'Set VARIABLE VALUES In THE CMM PROGRAM '--------------------------------------------------------------------------------- 'Below: pass variables back To the PC-DMIS Program '------------------------------------------------------------------------------------ 'Declare the variables Dim OPR1 As String Dim SFT1 As String Dim CUST1 As String Dim RSN1 As String Dim CMT1 As String Dim MAL1 As String Dim PID1 As String Dim MSC1 As String Dim Capno1 As String Dim Rev As String Dim INSP As String Dim Castd As String Dim Foundry As String Dim Comment As String Dim WO As String Dim Req As String Dim Discrip As String Dim PartN As String 'Assign data To the variables INSP = Dlg1.CmboBox6 SFT = SSEL CUST = Dlg1.CmboBox1 Req = Dlg1.CmboBox3 ITYPE = Dlg1.CmboBox4 Comment = Dlg1.TextBox2 REV = Dlg1.TextBox33 Castd = Dlg1.TextBox44 Foundry = Dlg1.TextBox55 WO = Dlg1.TextBox66 'MAL = Dlg1.ChkBox1 Capno1=Capno Discrip = Dlg1.TextBox88 PartN = Dlg1.TextBox77 'If MAL1 = "1" Then 'MAL1 = "YES" 'End If MSC1 = "N/A" CPRESS Dim App As Object Set App = CreateObject("PCDLRN.Application") Dim Part As Object Set Part = App.ActivePartProgram Dim Cmds As Object Dim Cmd As Object Set Cmds = Part.Commands For Each Cmd In Cmds If Cmd.Type = ASSIGNMENT Then If Cmd.GetText(DEST_EXPR, 0) = "INSP" Then bln = Cmd.PutText("""" + INSP+ """", SRC_EXPR, 0) Cmd.ReDraw End If If Cmd.GetText(DEST_EXPR, 0) = "CUST" Then bln = Cmd.PutText("""" + Cust + """",SRC_EXPR ,0 ) Cmd.ReDraw End If If Cmd.GetText(DEST_EXPR,0) = "REV" Then bln = Cmd.PutText("""" + REV + """", SRC_EXPR, 0) Cmd.ReDraw End If If Cmd.GetText(DEST_EXPR,0) = "CastD" Then bln = Cmd.PutText("""" + Castd + """", SRC_EXPR, 0) Cmd.ReDraw End If If Cmd.GetText(DEST_EXPR,0) = "FOUNDRY" Then bln = Cmd.PutText("""" + FOUNDRY + """", SRC_EXPR, 0) Cmd.ReDraw End If If Cmd.GetText(DEST_EXPR,0) = "ITYPE" Then bln = Cmd.PutText("""" + ITYPE + """", SRC_EXPR, 0) Cmd.ReDraw End If If Cmd.GetText(DEST_EXPR,0) = "WO" Then bln = Cmd.PutText("""" + WO + """", SRC_EXPR, 0) Cmd.ReDraw End If If Cmd.GetText(DEST_EXPR,0) = "Comment" Then bln = Cmd.PutText("""" + Comment + """", SRC_EXPR, 0) Cmd.ReDraw End If If Cmd.GetText(DEST_EXPR,0) = "Req" Then bln = Cmd.PutText("""" + Req + """", SRC_EXPR, 0) Cmd.ReDraw End If If Cmd.GetText(DEST_EXPR,0) = "Discrip" Then bln = Cmd.PutText("""" + Discrip + """", SRC_EXPR, 0) Cmd.ReDraw End If If Cmd.GetText(DEST_EXPR,0) = "PARTN" Then bln = Cmd.PutText("""" + PARTN + """", SRC_EXPR, 0) Cmd.ReDraw End If If Cmd.GetText(DEST_EXPR,0) = "V3" Then bln = Cmd.PutText("""" + V3 + """", SRC_EXPR, 0) Cmd.ReDraw End If End If 'End If Next Cmd End Sub
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |