hexagon logo

Getting Input Variables into PCDMIS from a Script

I am using a custom header that I have Tracfields input for the part informaiton. Part Number, Serial Number etc.. I want to use this script that I found for the dialog box instead of Tracefields but I can't figure out how to modify it so that PCDMIS pulls that data back into the program. This really is more for when we output to Excel, the report gets saved based on the variable inputs. I have pasted below the script we are using.

Right now our header just pulls in the Tracefield(1), Tracefield(2) and so on....

Any help would be apprieciated, as I have spent a couple hours trying to figure it out.



Matt Furtaw




Sub Main

Dim App As Object
Set App = CreateObject("PCDLRN.Application")

Dim Part As Object
Set Part = App.ActivePartProgram

Dim PartProg As Object
Set PartProg = App.ActivePartProgram

Dim Cmds As Object
Set Cmds = Part.Commands

Dim Cmd As Object

Dim Pname As String
Dim Rnum As String
Dim Snum As String

Dim CMMnum As String
Dim CusName As String
Dim PartNum As String
Dim TRCNum As String
Dim FileName As String

'Ask For part info from operator
'CustName = InputBox$("Please enter the 3 letter custumer prefix","Operator","",200,175)
'CMMnum = InputBox$("Please enter CMM Number","Operator","",200,175)
'PartNum = InputBox$("Please enter the Part Number","Operator","",200,175)
'TRCNum = InputBox$("Please enter the TRC Number","Operator","",200,175)

'Dialog Box instead of Input Boxes
Begin Dialog DLG_SAVE_AS 162,-3, 90, 149, "Please Enter Part Information"
TextBox 4,16,76,12, .EditBox_1
Text 4,4,60,12, "Customer Prefix"
TextBox 4,44,76,12, .EditBox_2
Text 4,32,60,12, "CMM Number"
TextBox 4,72,76,12, .EditBox_3
Text 4,60,60,12, "Part Number"
TextBox 4,100,76,12, .EditBox_4
Text 4,88,60,12, "TRC Number"
OKButton 22,116,40,14
CancelButton 22,132,40,14
End Dialog

Dim dlg1 As DLG_SAVE_AS
buttonval = Dialog(dlg1)

CustName = dlg1.EditBox_1
CMMnum = dlg1.EditBox_2
PartNum = dlg1.EditBox_3
TRCNum = dlg1.EditBox_4

'Creates the String For the filename
FileName = CustName & CMMnum & " - " & PartNum & " - TRC-" & TRCNum

'MsgBox FileName

'Check For file
Check = FileIO.FailIfExists

'MsgBox Check

'Dim Save As Object (not needed?)
Save = PartProg.SaveAs(FileName)

'This section changes the header values
Pname = CustName & CMMnum
Rnum = PartNum
Snum = "TRC-" & TRCNum

'MsgBox Pname
'MsgBox Rnum
'MsgBox Snum

PartProg.PartName = Pname
PartProg.RevisionNumber = Rnum
PartProg.SerialNumber = Snum

For Each Cmd In Cmds
Cmd.Marked = True
Next Cmd

End Sub