ToleranceCommand Object
Description
You can use the ToleranceCommand object to automate Geometric Tolerances commands inside of PC-DMIS.
Object Model
Example
This short example shows how to read through and list the features and segments of a Geometric Tolerance command.
Dim DmisApp As Object Dim DmisPart As Object Dim Commands As Object Dim Command As Object Dim ToleranceCommand As Object Dim i As Integer Sub Main Set DmisApp = CreateObject("PCDLRN.Application") Set DmisPart = DmisApp.ActivePartProgram Set Commands = DmisPart.Commands For Each Command In Commands If Command.IsToleranceCommand Then Set ToleranceCommand = Command.ToleranceCommand MsgBox ToleranceCommand.ID & " " & ToleranceCommand.SegmentCount & " " & ToleranceCommand.FeatureCount & " " & ToleranceCommand.SpecificationString For i = 1 To ToleranceCommand.FeatureCount MsgBox ToleranceCommand.FeatureID(i) & " " & ToleranceCommand.DatumFosId(i) Next i Set ToleranceCommand = Nothing End If Next Command Set Commands = Nothing Set DmisPart = Nothing Set DmisApp = Nothing End Sub
The following script reads through the geometric tolerance commands in a PC-DMIS measurement routine and displays the information in message boxes.
Geometric tolerance commands can have up to 5000 features referenced in up to five segments and can also include size information for both considered features and datum features.
The first thing the script does is to list the ID (dimension name), the number of segments, and the number of features.
It then lists all of the size information for all the features and datums.
Next, it loops through all of the datum features associated with each segment.
Finally, it loops through all of the considered features associated with each segment.
Sub Main Set DmisApp = CreateObject("PCDLRN.Application") Set DmisPart = DmisApp.ActivePartProgram Set Commands = DmisPart.Commands For Each Command In Commands If Command.IsToleranceCommand Then Set tolCmd = Command.ToleranceCommand MsgBox tolCmd.ID & " " & tolCmd.SegmentCount & " " & tolCmd.FeatureCount & " " & tolCmd.gdtSymbol For m = 1 To tolCmd.sizeCountCombined MsgBox tolCmd.sizeText(m) MsgBox tolCmd.sizeNominal(m) & " " & tolCmd.sizeMeasured(m) & " " & tolCmd.sizePlusTol(m) & " " & tolCmd.sizeMinusTol(m) & " " & tolCmd.sizeDeviation(m) & " " & tolCmd.sizeOutOfTol(m) Next m For i = 1 To tolCmd.SegmentCount For k = 1 To tolCmd.datumSizeCount MsgBox tolCmd.datumFosId(k) MsgBox tolCmd.datumFosNominal(k) & " " & tolCmd.datumFosMeasured(k) & " " & tolCmd.datumFosPlusTol(k) & " " & tolCmd.datumFosMinusTol(k) & " " & tolCmd.datumFosDeviation(k) & " " & tolCmd.datumFosOutTol(k) Next k For j = 1 To tolCmd.FeatureCount MsgBox tolCmd.FeatureID(j) MsgBox tolCmd.segmentDimNominal(i,j) & " " & tolCmd.segmentDimMeasured(i,j) & " " & tolCmd.segmentDimPlusTol(i,j) & " "& tolCmd.segmentDimMinusTol(i,j) & " " & tolCmd.segmentDimDeviation(i,j) & " " & tolCmd.segmentDimMax(i,j) & " " & tolCmd.segmentDimMin(i,j) & " " & tolCmd.segmentDimOutTol(i,j) Next j Next i Set ToleranceCommand = Nothing End If Next Command Set Commands = Nothing Set DmisPart = Nothing Set DmisApp = Nothing End Sub
See Also