hexagon logo

Find GeoTol Profile of a Surface with no Datums

I need to iterate through all the commands in a program looking for any GeoTol dimensions that are Profile of a Surface with no datums. 

How would I do this?

Parents
  • hi

    here is a basic script that does this, you can start it from pcDMIS or as an Excel macro.
    Output goes to "C:\Users\Public\Documents\ProfilSearchOutput.txt"

    only works with geotol profile

    Sub Main()
     ' Error
       On Error Resume Next
    
     ' Dim something
       Dim DmisApp As Object
       Dim DmisPart As Object
       Dim DmisCommands As Object
       Dim DmisCommand As Object
       Set DmisApp = CreateObject("PCDLRN.Application")
       Set DmisPart = DmisApp.ActivePartProgram
       Set DmisCommands = DmisPart.Commands
    
       Dim iCmdCount, iProfilCount, iNoDatumCount As Integer
       Dim sPath As String
       'sPath = DmisApp.GetSystemDocuments(False)
       sPath = "C:\Users\Public\Documents\ProfilSearchOutput.txt"
    
     ' open file
       Open sPath For Output As #1
       Print #1, DmisPart.FullName
       Print #1, DmisPart.ProgramVersionName
       Print #1, " "
    
     ' search part
       iCmdCount = 0
       iProfilCount = 0
       iNoDatumCount = 0
       For Each DmisCommand In DmisCommands
         iCmdCount = iCmdCount + 1
         If (DmisCommand.Type = ISO_TOLERANCE_COMMAND) Or (DmisCommand.Type = ASME_TOLERANCE_COMMAND) Then
           'retval = DmisCommand.SetToggleString(8, SEGMENT_TYPE_TOGGLE, 1) -> line
           'retval = DmisCommand.SetToggleString(9, SEGMENT_TYPE_TOGGLE, 1) -> plane
           If (DmisCommand.GetToggleValue(SEGMENT_TYPE_TOGGLE, 1) = 8) Or (DmisCommand.GetToggleValue(SEGMENT_TYPE_TOGGLE, 1) = 9) Then
             iProfilCount = iProfilCount + 1
             If DmisCommand.GetTextEx(DATUM_ID, 1, "SEG=1") = "" Then
               iNoDatumCount = iNoDatumCount + 1
               Print #1, "Nr: " & CStr(iCmdCount) & " " & DmisCommand.ID
             End If
           End If
         End If
       Next DmisCommand
       
     ' close file
       Print #1, " "
       Print #1, "Command Count: " & CStr(iCmdCount)
       Print #1, "Profil Count: " & CStr(iProfilCount)
       Print #1, "no Datum Count: " & CStr(iNoDatumCount)
       Close #1
    
     ' unDim something
       Set DmisCommand = Nothing
       Set DmisCommands = Nothing
       Set DmisPart = Nothing
       Set DmisApp = Nothing
    End Sub

Reply
  • hi

    here is a basic script that does this, you can start it from pcDMIS or as an Excel macro.
    Output goes to "C:\Users\Public\Documents\ProfilSearchOutput.txt"

    only works with geotol profile

    Sub Main()
     ' Error
       On Error Resume Next
    
     ' Dim something
       Dim DmisApp As Object
       Dim DmisPart As Object
       Dim DmisCommands As Object
       Dim DmisCommand As Object
       Set DmisApp = CreateObject("PCDLRN.Application")
       Set DmisPart = DmisApp.ActivePartProgram
       Set DmisCommands = DmisPart.Commands
    
       Dim iCmdCount, iProfilCount, iNoDatumCount As Integer
       Dim sPath As String
       'sPath = DmisApp.GetSystemDocuments(False)
       sPath = "C:\Users\Public\Documents\ProfilSearchOutput.txt"
    
     ' open file
       Open sPath For Output As #1
       Print #1, DmisPart.FullName
       Print #1, DmisPart.ProgramVersionName
       Print #1, " "
    
     ' search part
       iCmdCount = 0
       iProfilCount = 0
       iNoDatumCount = 0
       For Each DmisCommand In DmisCommands
         iCmdCount = iCmdCount + 1
         If (DmisCommand.Type = ISO_TOLERANCE_COMMAND) Or (DmisCommand.Type = ASME_TOLERANCE_COMMAND) Then
           'retval = DmisCommand.SetToggleString(8, SEGMENT_TYPE_TOGGLE, 1) -> line
           'retval = DmisCommand.SetToggleString(9, SEGMENT_TYPE_TOGGLE, 1) -> plane
           If (DmisCommand.GetToggleValue(SEGMENT_TYPE_TOGGLE, 1) = 8) Or (DmisCommand.GetToggleValue(SEGMENT_TYPE_TOGGLE, 1) = 9) Then
             iProfilCount = iProfilCount + 1
             If DmisCommand.GetTextEx(DATUM_ID, 1, "SEG=1") = "" Then
               iNoDatumCount = iNoDatumCount + 1
               Print #1, "Nr: " & CStr(iCmdCount) & " " & DmisCommand.ID
             End If
           End If
         End If
       Next DmisCommand
       
     ' close file
       Print #1, " "
       Print #1, "Command Count: " & CStr(iCmdCount)
       Print #1, "Profil Count: " & CStr(iProfilCount)
       Print #1, "no Datum Count: " & CStr(iNoDatumCount)
       Close #1
    
     ' unDim something
       Set DmisCommand = Nothing
       Set DmisCommands = Nothing
       Set DmisPart = Nothing
       Set DmisApp = Nothing
    End Sub

Children