hexagon logo

Perimeter Scan

Hello all,
I'm trying to extract the xyz values from a perimeter scan edge hit.
I'm having trouble navigating down the object hierarchy.
I see a PCDSCANHITTYPE and PCD_EDGEHIT, but
I don't know enough to get the xyz values into variables.

Any help would be appreciated.

Thanks in advance.
Parents
  • Hello,

    why do you want to insert movement points based on touch points.. doesn't that always lead to a collision?​
    what exactly do you want to achieve?


    ...
    this code only works if there is only one scan in the measurement program (only the points from the last scan are recorded).
    the measurement points are stored in an array​

    and since the movement points are aimed at the contact points, this definitely leads to a collision...
    I hope you know what you're doing

    Sub Main_230709()
    ' Dim something ---------------------------
      Dim App As Object
      Set App = CreateObject("PCDLRN.Application")
      Dim Part As Object
      Set Part = App.ActivePartProgram
      Dim Cmds As Object
      Set Cmds = Part.Commands
      Dim Cmd As Object
      Set Cmd = Nothing
     
      Dim sPath As String
      Dim iPoints As Integer
      Dim mx(), my(), mz() As Double
     
     
    ' File
      sPath = "C:\Test.txt"
      Open sPath For Output As #1
     
    ' search
      For Each Cmd In Cmds
        If Cmd.Type = BASIC_SCAN_OBJECT Then
          iPoints = Cmd.GetText(N_HITS, 0)
          ReDim mx(iPoints)
          ReDim my(iPoints)
          ReDim mz(iPoints)
          
          For iCount = 1 To iPoints
            mx(iCount) = Cmd.GetText(MEAS_X, iCount)
            my(iCount) = Cmd.GetText(MEAS_Y, iCount)
            mz(iCount) = Cmd.GetText(MEAS_Z, iCount)
            
            'Print #1, "MOVE/POINT,NORMAL,<", xm, ",", ym, ",", zm, ">"
          Next iCount
        End If
      Next Cmd
     
      Close #1
     
    ' add
      retVal = Cmds.InsertionPointAfter(Cmds.LastCommand)
      For iCount = 1 To iPoints
        Set Cmd = Cmds.Add(MOVE_POINT, True)
        Cmd.Marked = True
        retVal = Cmd.SetToggleString(1, NORM_RELEARN, 0)
        retVal = Cmd.PutText(CStr(mx(iCount)), THEO_X, 0)
        retVal = Cmd.PutText(CStr(my(iCount)), THEO_Y, 0)
        retVal = Cmd.PutText(CStr(mz(iCount)), THEO_Z, 0)
      Next iCount
      Part.RefreshPart
     
    End Sub​
    
Reply
  • Hello,

    why do you want to insert movement points based on touch points.. doesn't that always lead to a collision?​
    what exactly do you want to achieve?


    ...
    this code only works if there is only one scan in the measurement program (only the points from the last scan are recorded).
    the measurement points are stored in an array​

    and since the movement points are aimed at the contact points, this definitely leads to a collision...
    I hope you know what you're doing

    Sub Main_230709()
    ' Dim something ---------------------------
      Dim App As Object
      Set App = CreateObject("PCDLRN.Application")
      Dim Part As Object
      Set Part = App.ActivePartProgram
      Dim Cmds As Object
      Set Cmds = Part.Commands
      Dim Cmd As Object
      Set Cmd = Nothing
     
      Dim sPath As String
      Dim iPoints As Integer
      Dim mx(), my(), mz() As Double
     
     
    ' File
      sPath = "C:\Test.txt"
      Open sPath For Output As #1
     
    ' search
      For Each Cmd In Cmds
        If Cmd.Type = BASIC_SCAN_OBJECT Then
          iPoints = Cmd.GetText(N_HITS, 0)
          ReDim mx(iPoints)
          ReDim my(iPoints)
          ReDim mz(iPoints)
          
          For iCount = 1 To iPoints
            mx(iCount) = Cmd.GetText(MEAS_X, iCount)
            my(iCount) = Cmd.GetText(MEAS_Y, iCount)
            mz(iCount) = Cmd.GetText(MEAS_Z, iCount)
            
            'Print #1, "MOVE/POINT,NORMAL,<", xm, ",", ym, ",", zm, ">"
          Next iCount
        End If
      Next Cmd
     
      Close #1
     
    ' add
      retVal = Cmds.InsertionPointAfter(Cmds.LastCommand)
      For iCount = 1 To iPoints
        Set Cmd = Cmds.Add(MOVE_POINT, True)
        Cmd.Marked = True
        retVal = Cmd.SetToggleString(1, NORM_RELEARN, 0)
        retVal = Cmd.PutText(CStr(mx(iCount)), THEO_X, 0)
        retVal = Cmd.PutText(CStr(my(iCount)), THEO_Y, 0)
        retVal = Cmd.PutText(CStr(mz(iCount)), THEO_Z, 0)
      Next iCount
      Part.RefreshPart
     
    End Sub​
    
Children
No Data