Your Products have been synced, click here to refresh
'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 StrDimDiameter As String Dim StrDimPlane As String Dim MeasZ As String Dim Clock As String Dim Part As String Dim DimMeas As Double Dim MyComment As Double 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.IsComment Then If ObjCmd.CommentCommand.CommentType = PCD_COMMENT_INPUT Then If ObjCmd.ID = "C1" Then StrC1 = ObjCmd.CommentCommand.Input End If End If End If If ObjCmd.IsComment Then If ObjCmd.CommentCommand.CommentType = PCD_COMMENT_INPUT Then If ObjCmd.ID = "C2" Then StrC2 = ObjCmd.CommentCommand.Input End If End If End If If ObjCmd.IsDimension Then Set ObjDimCmd = ObjCmd.DimensionCommand StrDimID = ObjDimCmd.ID StrDimFeature = ObjDimCmd.Feat1 StrDimType = ObjCmd.Type StrDimNominal = ObjDimCmd.Nominal StrDimUTol = ObjDimCmd.Plus StrDimLTol = ObjDimCmd.Minus StrDimMeasure = ObjDimCmd.Measured If (StrDimType = "DIMENSION_START_LOCATION" Or StrDimType = "DIMENSION_Z_LOCATION") Then StrDimPlane=ObjCmd.GetText(DIM_MEASURED,0) End If ElseIf ObjCmd.IsFeature Then StrDimID = ObjCmd.FeatureCommand.ID StrDimDiameter = ObjCmd.FeatureCommand.MeasDiam MeasZ = ObjCmd.GetText(MEAS_Z,0) End If If StrDimID = "CIR2- OUTER CIRCLE ABOVE STEP" Then MyReading1 = StrDimDiameter If StrDimID = "ROUNDNESS CIRC2" Then MyReading2 = StrDimMeasure If StrDimID = "CIR3- RADIUS OF STEP ON OUTER EDGE" Then MyReading3 = StrDimDiameter If StrDimID = "CIR6- OUTER CIRCLE BELOW STEP" Then MyReading4 = StrDimDiameter If StrDimID = "ROUNDNESS CIRC6" Then MyReading5 = StrDimMeasure If StrDimID = "CONC1" Then MyReading6 = StrDimMeasure If StrDimID = "CONC2" Then MyReading7 = StrDimMeasure If StrDimID = "POINT 1Z" Then MyReading8 = StrDimMeasure If StrDimID = "POINT 2Z" Then MyReading9 = StrDimMeasure If StrDimID = "POINT 3Z" Then MyReading10 = StrDimMeasure If StrDimID = "POINT 4Z" Then MyReading11 = StrDimMeasure If StrDimID = "PLANE4 Z" Then MyReading12 = StrDimMeasure If StrDimID = "PLANE5- COMBINATION OF POINT 1 2 3 4 ON STEP" Then MyReading13 = MeasZ If StrDimID = "POINT5Z" Then MyReading14 = MeasZ If StrDimID = "POINT6Z" Then MyReading15 = MeasZ If StrDimID = "POINT7Z" Then MyReading16 = MeasZ If StrDimID = "POINT8Z" Then MyReading17 = MeasZ Next
I have a general question. Are you trying to capture every dimension in the program for spc, or selected dimensions only?
Will try to comment on the code later.
I am questioning something with the plane4 spec that I want to pull out. Now, If I pull it out as a feature and the MEAS_Z command, I get about 1/2 of the whole reading which should be .51. Now this part has a step in it that goes from the bottom to .25. The measurement I get out of PCDMIS is enough to add in that .25 step and come up with that .51 as a whole.
So my question is, is this a common thing with PCDMIS, or is this dependent on how whoever programmed this part into the system?
But if I use a dimension command object, I get zero. So, I have to use something.
That's because your code is incorrect.
There are a lot of problems in the last code you posted, and I apologize, but I just can't spend the time required to explain/discuss. To do so accurately, I would have to do it from work (with pcdmis in front of me), and that is not what they pay me to do.
You may want to look into QC-Calc RealTime. This is a package that absolutely excels at collecting data from all types of measuring equipment, and then exporting in formats that can be used by other softwares (including WinSPC). "From QC-Calc to WinSPC in 2 seconds flat" according to their website. It is very inexpensive as well. Using this tool, no scripting would be required, but very minor modifications to part programs would be necessary. (STATS/ON or XMLSTATS/ON depending on your pc-dmis version).
http://www.prolinksoftware.com/specific.aspx?type=rt
http://www.prolinksoftware.com/product_article.aspx?id=170
Edit: one last thought - if you consider the path you are currently on, you are looking at having a custom import script for each program, or in the best case, a generic script with some sort of text files containing the mapping between pcdmis tolerances and WinSPC. This is all time consuming setup and maintenance over time. QC-Calc should be an easy sell to management.
' ================================================================ ' The export file format: ' FeatType,FeatName,ValueID,Meas,Theo,Dev,-Tol,+Tol,OutTol,Comment ' ================================================================ ' ' Change history ' ' 2005-11-16 PCDMIS bugs With True position: ' ' We can have OutTol <> 0 (very small number) even when Deviation = 0, also ' Deviation can be a very small number (looks like conversion artifacts Single <--> Double) ' ' If Abs(Dev) < 0.00005 Set elDev = 0 Else Set elDev = Deviation ' If Abs(OutTol) < 0.00005 Set elOutTol = 0 Else Set elOutTol = OutTol ' ' True Position can have Nominal = 0, Measured = 0 but Deviation <> 0 ' Solved by setting elAct = Nominal + elDev ' ' Note: This script does *not* handle FCF dimensions ' ================================================================ ' Dim elType As String Dim elName As String Dim elValueType As String Dim elAct As Double Dim elNom As Double Dim elDev As Double Dim elMtol As Double Dim elPtol As Double Dim elOutTol As Double Dim elComment As String Dim elStarted As Integer ' ================================================================ Sub ClearRecord elType = "type" elName = "name" elValueType = "valuetype" elAct = 0 elNom = 0 elDev = 0 elMtol = 0 elPtol = 0 elOutTol = 0 elComment = "" End Sub Sub PrintLine(FileNum%) If elStarted Then Print #FileNum, elType; ","; elName; ","; elValueType; ","; elAct; ","; elNom; ","; elDev; "," ; elMtol; ","; elPtol; ","; elOutTol; ","; elComment elStarted = 0 End If End Sub Sub ExportAsCSV(FileName$) Dim DmisApp As Object Dim DmisPart As Object Dim DmisCommands As Object Dim DmisCommand As Object Dim DmisDimension As Object Dim ix As Integer Dim fNum As Integer Dim ID As String Dim State As Integer Dim DoOutput As Integer fNum = FreeFile Open FileName$ For Output As fNum ' 2005-11-17 Print #fNum, "' FeatType,FeatName,ValueID,Meas,Theo,Dev,-Tol,+Tol,OutTol,Comment" ' ---------- Set DmisApp = CreateObject("PCDLRN.Application") Set DmisPart = DmisApp.ActivePartProgram Set DmisCommands = DmisPart.Commands elStarted = 0 State = 1 For ix = 1 To DmisCommands.Count Set DmisCommand = DmisCommands(ix) If DmisCommand.IsDimension Then Set DmisDimension = DmisCommand.DimensionCommand Select Case State Case 1 ' Normal Case If (DmisDimension.OutputMode <> DIMOUTPUT_NONE) Then DoOutput = 1 Else DoOutput = 0 End If ID = DmisDimension.ID If (DmisCommand.Type = DIMENSION_TRUE_START_POSITION) Then State = 2 ElseIf (DmisCommand.Type = DIMENSION_START_LOCATION) Then State = 3 End If If (DoOutput = 1) And (State = 1) Then PrintLine(fNum) ClearRecord elType = DmisCommand.TypeDescription elName = ID ' 2005-11-17 If DmisDimension.AxisLetter = "D" Then elValueType = "DIAM" Elseif DmisDimension.AxisLetter = "R" Then elValueType = "RAD" Else elValueType = DmisDimension.AxisLetter End If ' --------- elNom = DmisDimension.Nominal ' 2005-11-16 If (Abs(DmisDimension.Deviation) > 0.00005) Then elDev = DmisDimension.Deviation Else elDev = 0 End If elAct = DmisDimension.Nominal + elDev ' --------- elMtol = -DmisDimension.Minus elPtol = DmisDimension.Plus ' 2005-11-16 If (Abs(DmisDimension.OutTol) > 0.00005) Then elOutTol = DmisDimension.OutTol Else elOutTol = 0 End If ' --------- elComment = "" elStarted = 1 End If Case 2 ' True Position If (DoOutput = 1) Then PrintLine(fNum) ClearRecord elType = DmisCommand.TypeDescription elName = ID ' 2005-11-17 If DmisDimension.AxisLetter = "D" Then elValueType = "DIAM" Elseif DmisDimension.AxisLetter = "R" Then elValueType = "RAD" Else elValueType = DmisDimension.AxisLetter End If ' --------- elNom = DmisDimension.Nominal ' 2005-11-16 If (Abs(DmisDimension.Deviation) > 0.00005) Then elDev = DmisDimension.Deviation Else elDev = 0 End If elAct = DmisDimension.Nominal + elDev ' --------- elMtol = -DmisDimension.Minus elPtol = DmisDimension.Plus ' 2005-11-16 If (Abs(DmisDimension.OutTol) > 0.00005) Then elOutTol = DmisDimension.OutTol Else elOutTol = 0 End If ' --------- elComment = "" elStarted = 1 End If Case 3 ' Location If (DoOutput = 1) Then PrintLine(fNum) ClearRecord elType = DmisCommand.TypeDescription elName = ID ' 2005-11-17 If DmisDimension.AxisLetter = "D" Then elValueType = "DIAM" Elseif DmisDimension.AxisLetter = "R" Then elValueType = "RAD" Else elValueType = DmisDimension.AxisLetter End If ' --------- elNom = DmisDimension.Nominal ' 2005-11-16 If (Abs(DmisDimension.Deviation) > 0.00005) Then elDev = DmisDimension.Deviation Else elDev = 0 End If elAct = DmisDimension.Nominal + elDev ' --------- elMtol = -DmisDimension.Minus elPtol = DmisDimension.Plus ' 2005-11-16 If (Abs(DmisDimension.OutTol) > 0.00005) Then elOutTol = DmisDimension.OutTol Else elOutTol = 0 End If ' --------- elComment = "" elStarted = 1 End If End Select Set DmisDimension = Nothing ElseIf (DmisCommand.Type = DIMENSION_TRUE_END_POSITION) Then State = 1 ElseIf (DmisCommand.Type = DIMENSION_END_LOCATION) Then State = 1 End If Set DmisCommand = Nothing Next ix Set DmisCommands = Nothing Set DmisPart = Nothing Set DmisApp = Nothing PrintLine(fNum) Close #fNum Print "Klart" End Sub Sub Main(FileName$) 'ExportAsCSV(FileName$) ' For deployment ExportAsCSV("EXPORT.TXT") ' For testing End Sub
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |