I greatly appreciate any help.
Your Products have been synced, click here to refresh
Sub Main()
'this *.bas is a simple, modified version of the outtol.bas whose author I do not know
'if any one knows the author credit them here
'
'craig
Dim objApp As Object
Set objApp = CreateObject("PCDLRN.Application")
Dim objPart As Object
Set objPart = objApp.ActivePartProgram
Dim objCmds As Object
Set objCmds = objPart.Commands
Dim objCmd As Object
Dim objDimCmd As Object
Dim lngOutTol As Long
lngOutTol = 0
Dim lngTotalMeas As Long
lngTotalMeas = 0
Dim objOutTol As Object
Set objOutTol = objPart.GetVariableValue("NUMBEROUTTOL")
Dim objTotalMeas As Object
Set objtTotalMeas = objPart.GetVariableValue("TOTALMEASURED")
For Each objCmd In objCmds
If objCmd.IsDimension Then
If objCmd.Type <> DIMENSION_START_LOCATION And _
objCmd.Type <> DIMENSION_END_LOCATION And _
objCmd.Type <> DIMENSION_TRUE_START_POSITION And _
objCmd.Type <> DIMENSION_TRUE_END_POSITION Then
Set objDimCmd = objCmd.DimensionCommand
If objDimCmd.OutTol > 0 Then
lngOutTol = lngOutTol + 1
End If
lngTotalMeas = lngTotalMeas + 1
End If
End If
Next objCmd
objOutTol.LongValue = lngOutTol
objtTotalMeas.LongValue = lngTotalMeas
objPart.SetVariableValue "NUMBEROUTTOL", objOutTol
objPart.SetVariableValue "TOTALMEASURED", objtTotalMeas
End Sub
If Not OutTolValue is Nothing Then Part.SetVariableValue OutTolVar, OutTolValue End If [COLOR="#FF0000"] if (OutTolValue > 0) then MsgBox "Some values are out of tolerance! Check the report" end if [/COLOR] Else MsgBox "Variabeln " + OutTolVar + " saknas i PCDMIS-programmet!"
in the code section there's my "count outtol" script, which includes fcf:s - http://www.pcdmisforum.com/showthread.php?30251-counting-outtol-in-a-program
just insert the red lines at the indicated end of the script:
if not outtolvalue is nothing then part.setvariablevalue outtolvar, outtolvalue end if [color="#ff0000"] if (outtolvalue > 0) then msgbox "ooook ook ook, ooook oooook okkkk! Good boy want a 'nanna?" end if [/color] else msgbox "variabeln " + outtolvar + " saknas i pcdmis-programmet!"
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |