Now that I have information in a way that imports and exports the information correctly, I have been tasked with creating an OLE to automatically import the data into the SPC software. I have one that sort of works (as in opens the program, logs in, opens the right collection plan, etc) and I can get put in static information, but I am unsure how to call the information out of PC DMIS to have it be placed in the spots we need in the SPC software being used.
Has anyone else done this? Can anyone explain to me how find the variable and the measurement output in PC DMIS? I am using version 4.2 if that helps any.
Begin VB.Form Form1
caption = "Visual Basic OLE Client for WinSPC"
ClientHeight = 4485
ClientLeft = 60
ClientTop = 630
ClientWidth = 6150
LinkTopic = "Form1"
ScaleHeight = 4485
ScaleWidth = 6150
Begin VB.TextBox Text1
Height = 4455
Left = 0
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 0
Width = 6135
End
Begin VB.Menu RunMenu
Caption = "&Run"
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredID = True
Attribute VB_Expose = False
'Declare variables
Sub main
Dim PartObj As Object
Dim CPObj As Object
Dim DCObj As Object
Dim DBObj As Object
Dim UserName As String
Dim Password As String
Dim sPart As String
Dim sVar1 As String
Dim sVar2 As String
Dim sCollPlan As String
Dim PartID As Long
Dim Var1ID As Long
Dim Var2ID As Long
Dim CollPlanID As Long
Dim Step1ID As Long
Dim Step2ID As Long
Dim CollectionPlanID As Object
Dim dc As Object
'PCDMIS commands
Dim ObjApp As Object
Dim ObjCmds As Object
Dim ObjCmd As Object
Dim ObjPart As Object
Dim ObjDimCmd as Object
Dim lngNumCmds As Long
Set ObjApp = CreateObject("PCDLRN.Application")
Set ObjPart = ObjApp.ActivePartProgram
Set ObjCmds = ObjPart.Commands
set lngNumCmds = ObjCmds.Count
Dim StrDimID As String
Dim StrDimFeature As String
Dim StrDimType As String
Dim StrDimNominal As String
Dim StrDimUTol As String
Dim StrDimLTol As String
Dim StrDimMeasure As String
Dim MyReading1 As Double
Dim MyReading2 As Double
Dim MyReading3 As Double
Dim MyReading4 As Double
Dim MyReading5 As Double
Dim MyReading6 As Double
Dim MyReading7 As Double
Dim MyReading8 As Double
Dim MyReading9 As Double
Dim MyReading10 As Double
Dim MyReading11 As Double
Dim MyReading12 As Double
Dim MyReading13 As Double
Dim MyReading14 As Double
Dim MyReading15 As Double
Dim MyReading16 As Double
For Each ObjCmd In ObjCmds
If ObjCmd.IsDimension Then
Set ObjDimCmd = ObjCmd.DimensionCommand
StrDimID = ObjDimCmd.ID
StrDimFeature = ObjDimCmd.Feat1
StrDimType = ObjDimCmd.AxisLetter
StrDimNominal = ObjDimCmd.Nominal
StrDimUTol = ObjDimCmd.Plus
StrDimLTol = ObjDimCmd.Minus
StrDimMeasure = ObjDimCmd.Measured
ElseIf ObjCmd.IsFeature Then
StrDimID = ObjCmd.FeatureCommand.ID
StrDimDiameter = ObjCmd.FeatureCommand.MeasDiam
MeasZ = ObjCmd.FeatureCommand.MeasHeight
End If
So, we are one step closer to getting this to work as desired. With this I now have diameters, and all measurements with an AX of M (had that before). So my guess is either I labeled the variables that get the measz variable included or that the measz variable has a feature command of measlength and not measheight.
I so appreciate your patience and all the help. I don't think I could have done this with out it. If I ever make it to Sweden, I will buy you a drink (coffee, soda, beer, whatever your preference). And you never know, since that is on my list of places to travel. My family is from there, many generations ago.
Begin VB.Form Form1
caption = "Visual Basic OLE Client for WinSPC"
ClientHeight = 4485
ClientLeft = 60
ClientTop = 630
ClientWidth = 6150
LinkTopic = "Form1"
ScaleHeight = 4485
ScaleWidth = 6150
Begin VB.TextBox Text1
Height = 4455
Left = 0
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 0
Width = 6135
End
Begin VB.Menu RunMenu
Caption = "&Run"
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredID = True
Attribute VB_Expose = False
'Declare variables
Sub main
Dim PartObj As Object
Dim CPObj As Object
Dim DCObj As Object
Dim DBObj As Object
Dim UserName As String
Dim Password As String
Dim sPart As String
Dim sVar1 As String
Dim sVar2 As String
Dim sCollPlan As String
Dim PartID As Long
Dim Var1ID As Long
Dim Var2ID As Long
Dim CollPlanID As Long
Dim Step1ID As Long
Dim Step2ID As Long
Dim CollectionPlanID As Object
Dim dc As Object
'PCDMIS commands
Dim ObjApp As Object
Dim ObjCmds As Object
Dim ObjCmd As Object
Dim ObjPart As Object
Dim ObjDimCmd as Object
Dim lngNumCmds As Long
Set ObjApp = CreateObject("PCDLRN.Application")
Set ObjPart = ObjApp.ActivePartProgram
Set ObjCmds = ObjPart.Commands
set lngNumCmds = ObjCmds.Count
Dim StrDimID As String
Dim StrDimFeature As String
Dim StrDimType As String
Dim StrDimNominal As String
Dim StrDimUTol As String
Dim StrDimLTol As String
Dim StrDimMeasure As String
Dim MyReading1 As Double
Dim MyReading2 As Double
Dim MyReading3 As Double
Dim MyReading4 As Double
Dim MyReading5 As Double
Dim MyReading6 As Double
Dim MyReading7 As Double
Dim MyReading8 As Double
Dim MyReading9 As Double
Dim MyReading10 As Double
Dim MyReading11 As Double
Dim MyReading12 As Double
Dim MyReading13 As Double
Dim MyReading14 As Double
Dim MyReading15 As Double
Dim MyReading16 As Double
For Each ObjCmd In ObjCmds
If ObjCmd.IsDimension Then
Set ObjDimCmd = ObjCmd.DimensionCommand
StrDimID = ObjDimCmd.ID
StrDimFeature = ObjDimCmd.Feat1
StrDimType = ObjDimCmd.AxisLetter
StrDimNominal = ObjDimCmd.Nominal
StrDimUTol = ObjDimCmd.Plus
StrDimLTol = ObjDimCmd.Minus
StrDimMeasure = ObjDimCmd.Measured
ElseIf ObjCmd.IsFeature Then
StrDimID = ObjCmd.FeatureCommand.ID
StrDimDiameter = ObjCmd.FeatureCommand.MeasDiam
MeasZ = ObjCmd.FeatureCommand.MeasHeight
End If
So, we are one step closer to getting this to work as desired. With this I now have diameters, and all measurements with an AX of M (had that before). So my guess is either I labeled the variables that get the measz variable included or that the measz variable has a feature command of measlength and not measheight.
I so appreciate your patience and all the help. I don't think I could have done this with out it. If I ever make it to Sweden, I will buy you a drink (coffee, soda, beer, whatever your preference). And you never know, since that is on my list of places to travel. My family is from there, many generations ago.