hexagon logo

Passing a PC Dmis Variable into a Text object in Basic

Ok so I normally use a comment to display information about a program that I keep hardcoded in the program. Print Information, What operation the program is for. Just normal stuff for the operators. I'm trying to condense it all down to a neat window that has their inputs and will display the information as well. I can't seem to figure out how to display the contents of a PC Dmis variable in a text object in a Basic Script Dialogue display.


Set Partnam = Part.GetVariableValue("PARTNAM")

Text 160,40,80,12, .Text2

Dialg.Text2=Printnam.StringValue

I can't use the last line prior to the dialogue. If I use it after it still shows up blank. Any positive/constructive ideas? I'm sure i'm just missing a simple step.
Parents
  • Basic Script:
     
    Sub[SIZE=2][COLOR=#000000] Main[/COLOR]
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'PCDMIS COMMANDS assignment
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] App, Part, Cmds, Cmd [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Object
    Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] App = CreateObject("PCDLRN.Application")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Part = App.ActivePartProgram[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Cmds = Part.Commands[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Samp [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String
    Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Shift [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String
    Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Prognam, Printnam, Partnam, Partnum, Opera, Jo, Sam [/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Prognam= Part.GetVariableValue("CMMPROGRAM")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Printnam= Part.GetVariableValue("PRINTREV1")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Partnam= Part.GetVariableValue("PARTNAM")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Partnum= Part.GetVariableValue("PARTNUM")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Opera= Part.GetVariableValue("OPERATOR")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Jo= Part.GetVariableValue("JOB")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Sam= Part.GetVariableValue("SAMP")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Opens Dialog For Input
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Begin[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dialog[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] DIALOG_1 50,10, 300, 125, oOPERATORINPUT[/COLOR]
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Display text For Program Information
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    Text 160,10,80,12, "Program Name :"
    Text 160,20,80,12, .Text1
    Text 160,30,80,12, "Print Information :"
    Text 160,40,80,12, .Text2
    Text 160,50,80,12, "Part Name :"
    Text 160,60,80,12, .Text3
    Text 160,70,80,12, "Part Number :"
    Text 160,80,80,12, .Text4
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Box & Text For Operator Input
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    GroupBox 5,5,150,25
    Text 10,15,85,12, "Enter Operator :"
    TextBox 65,13,50,12, .EditBox_1
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Box & Text For Job # Input
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    GroupBox 5,25,150,25
    Text 10,35,85,12, "Enter Job # :"
    TextBox 65,33,50,12, .EditBox_2
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Box & Text For Sample # Input
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    GroupBox 5,45,150,25
    Text 10,55,85,12, "Enter Sample # :"
    TextBox 65,53,20,12, .EditBox_3
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Box & Buttons & Text For Shift Selection
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    GroupBox 5,65,150,25
    Text 10,75,25,12, "Shift # :"
    OptionGroup .grp1
    OptionButton 50,74,22,12, "1st", .option1
    OptionButton 75,74,22,12, "2nd", .option2
    OptionButton 100,74,22,12, "3rd", .option3
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Box & Text & Buttons For Help Request
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    GroupBox 5,85,150,35
    Text 10,95,50,24, "Notes :"
    Text 35,95,85,12, "(Check what you need)" 
    Text 10,105,35,12, "Fixturing?"
    CheckBox 45,104,20,12, .CheckBox_4
    Text 70,105,25,12,"Probe?"
    CheckBox 95,104,20,12, .CheckBox_5
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Ok And Cancel Buttons 
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    OKButton 160,100,57,15
    CancelButton 225,100,57,15
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dialog
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Code Begins
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Dialg [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] DIALOG_1[/COLOR]
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Dimension Text Boxes To show Variables
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    Dialg.Text1=Prognam.StringValue < ------ I'm trying to figure out how to get these to show
    Dialg.Text2=Printnam.StringValue [SIZE=2]< ------ [/SIZE]
    Dialg.Text3=Partnam.StringValue  [SIZE=2]< ------[/SIZE]
    Dialg.Text4=Partnum.StringValue  [SIZE=2]< ------[/SIZE]
    Dialg.EditBox_1=Opera.StringValue [SIZE=2]< ------ These would be used to show the last inputed[/SIZE]
    Dialg.EditBox_2=Jo.StringValue      [SIZE=2]< ------ Value[/SIZE]
    Dialg.EditBox_3=Sam.StringValue   [SIZE=2]< ------[/SIZE]
     
    button1 = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dialog[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](Dialg)
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Progtype [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String
    If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] button1 = 0 [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    Progtype= "END"
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Else
    [/COLOR][/SIZE][/COLOR][/SIZE]


    I can't seem to figure out how to have the values run during the dialogue execution. I have found some examples and I'm sure it's a simple step. It's just beyond my grasp currently. Any help at all would be appreciated.

    Edit: Ok got the .Text1 - .Text4 to work. I changed them to a Textbox and the worked like a dream.
    Now for the loading of previously entered values.
Reply
  • Basic Script:
     
    Sub[SIZE=2][COLOR=#000000] Main[/COLOR]
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'PCDMIS COMMANDS assignment
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] App, Part, Cmds, Cmd [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Object
    Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] App = CreateObject("PCDLRN.Application")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Part = App.ActivePartProgram[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Cmds = Part.Commands[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Samp [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String
    Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Shift [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String
    Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Prognam, Printnam, Partnam, Partnum, Opera, Jo, Sam [/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Prognam= Part.GetVariableValue("CMMPROGRAM")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Printnam= Part.GetVariableValue("PRINTREV1")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Partnam= Part.GetVariableValue("PARTNAM")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Partnum= Part.GetVariableValue("PARTNUM")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Opera= Part.GetVariableValue("OPERATOR")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Jo= Part.GetVariableValue("JOB")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Sam= Part.GetVariableValue("SAMP")[/COLOR]
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Opens Dialog For Input
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Begin[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dialog[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] DIALOG_1 50,10, 300, 125, oOPERATORINPUT[/COLOR]
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Display text For Program Information
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    Text 160,10,80,12, "Program Name :"
    Text 160,20,80,12, .Text1
    Text 160,30,80,12, "Print Information :"
    Text 160,40,80,12, .Text2
    Text 160,50,80,12, "Part Name :"
    Text 160,60,80,12, .Text3
    Text 160,70,80,12, "Part Number :"
    Text 160,80,80,12, .Text4
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Box & Text For Operator Input
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    GroupBox 5,5,150,25
    Text 10,15,85,12, "Enter Operator :"
    TextBox 65,13,50,12, .EditBox_1
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Box & Text For Job # Input
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    GroupBox 5,25,150,25
    Text 10,35,85,12, "Enter Job # :"
    TextBox 65,33,50,12, .EditBox_2
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Box & Text For Sample # Input
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    GroupBox 5,45,150,25
    Text 10,55,85,12, "Enter Sample # :"
    TextBox 65,53,20,12, .EditBox_3
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Box & Buttons & Text For Shift Selection
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    GroupBox 5,65,150,25
    Text 10,75,25,12, "Shift # :"
    OptionGroup .grp1
    OptionButton 50,74,22,12, "1st", .option1
    OptionButton 75,74,22,12, "2nd", .option2
    OptionButton 100,74,22,12, "3rd", .option3
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Box & Text & Buttons For Help Request
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    GroupBox 5,85,150,35
    Text 10,95,50,24, "Notes :"
    Text 35,95,85,12, "(Check what you need)" 
    Text 10,105,35,12, "Fixturing?"
    CheckBox 45,104,20,12, .CheckBox_4
    Text 70,105,25,12,"Probe?"
    CheckBox 95,104,20,12, .CheckBox_5
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Ok And Cancel Buttons 
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    OKButton 160,100,57,15
    CancelButton 225,100,57,15
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dialog
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Code Begins
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Dialg [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] DIALOG_1[/COLOR]
    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]
    'Dimension Text Boxes To show Variables
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    Dialg.Text1=Prognam.StringValue < ------ I'm trying to figure out how to get these to show
    Dialg.Text2=Printnam.StringValue [SIZE=2]< ------ [/SIZE]
    Dialg.Text3=Partnam.StringValue  [SIZE=2]< ------[/SIZE]
    Dialg.Text4=Partnum.StringValue  [SIZE=2]< ------[/SIZE]
    Dialg.EditBox_1=Opera.StringValue [SIZE=2]< ------ These would be used to show the last inputed[/SIZE]
    Dialg.EditBox_2=Jo.StringValue      [SIZE=2]< ------ Value[/SIZE]
    Dialg.EditBox_3=Sam.StringValue   [SIZE=2]< ------[/SIZE]
     
    button1 = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dialog[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](Dialg)
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Progtype [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String
    If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] button1 = 0 [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
    Progtype= "END"
    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]
    Else
    [/COLOR][/SIZE][/COLOR][/SIZE]


    I can't seem to figure out how to have the values run during the dialogue execution. I have found some examples and I'm sure it's a simple step. It's just beyond my grasp currently. Any help at all would be appreciated.

    Edit: Ok got the .Text1 - .Text4 to work. I changed them to a Textbox and the worked like a dream.
    Now for the loading of previously entered values.
Children
No Data