hexagon logo

Help me (Script to automate nominal replacement with variable)

Hello

Compile a program, how to use the Basic Script to realize the last coordinates every feature behind the Z coordinates (including the actual value and touch with measured values)
instead of letters W? Before this assignment, can give W Z axis control the decline of depth

thanks
Parents
  • ' Replaces a coordinate value in DCC/measured features
    ' with a variable. The example below replaces the 
    ' theoretical and target Z-coordinate with the contents
    ' of RChar (currently "W").
    ' Custommade for user 233229920 @ PC-DMIS User Forum
    '
    ' Ex. <10,20,30>, <0,0,1>
    ' (X,Y,Z), (I,J,K) will become
    ' <10,20,W>, <0,0,1>
    '
    ' vpt.se 2011
    
    Sub Main
    Dim PCDApp, PCDPartPrograms, PCDPartProgram, PCDCommands, PCDCommand
    
    'Initialization
    Set PCDApp = CreateObject("PCDLRN.Application")
    Set PCDPartPrograms = PCDApp.PartPrograms
    Set PCDPartProgram = PCDApp.ActivePartProgram
    Set PCDCommands = PCDPartProgram.Commands
    
    Dim iCnt As Integer
    Dim RChar As String
    
    [COLOR="#0000FF"]RChar [/COLOR]= "[COLOR="#FF0000"]W[/COLOR]"
    
    For iCnt = 1 To PCDCommands.Count
    Set PCDCommand = PCDCommands.Item(iCnt)
    
    If (PCDCommand.IsDCCFeature) or (PCDCommand.IsMeasuredFeature) Then
      retval = PCDCommand.SetExpression ([COLOR="#0000FF"]RChar[/COLOR], [COLOR="#FF0000"]THEO_Z[/COLOR], 0)
      retval = PCDCommand.SetExpression ([COLOR="#0000FF"]RChar[/COLOR], [COLOR="#FF0000"]TARG_Z[/COLOR], 0)
    End If
    PCDPartProgram.Refresh
    Next iCnt
    
    'Cleanup
    Set PCDCommands = Nothing
    Set PCDPartProgram = Nothing
    Set PCDPartPrograms = Nothing
    Set PCDApp = Nothing
    End Sub


    Use it on your own risk.

    It ONLY changes the feature coordinate - NOT the hit coordinate.
Reply
  • ' Replaces a coordinate value in DCC/measured features
    ' with a variable. The example below replaces the 
    ' theoretical and target Z-coordinate with the contents
    ' of RChar (currently "W").
    ' Custommade for user 233229920 @ PC-DMIS User Forum
    '
    ' Ex. <10,20,30>, <0,0,1>
    ' (X,Y,Z), (I,J,K) will become
    ' <10,20,W>, <0,0,1>
    '
    ' vpt.se 2011
    
    Sub Main
    Dim PCDApp, PCDPartPrograms, PCDPartProgram, PCDCommands, PCDCommand
    
    'Initialization
    Set PCDApp = CreateObject("PCDLRN.Application")
    Set PCDPartPrograms = PCDApp.PartPrograms
    Set PCDPartProgram = PCDApp.ActivePartProgram
    Set PCDCommands = PCDPartProgram.Commands
    
    Dim iCnt As Integer
    Dim RChar As String
    
    [COLOR="#0000FF"]RChar [/COLOR]= "[COLOR="#FF0000"]W[/COLOR]"
    
    For iCnt = 1 To PCDCommands.Count
    Set PCDCommand = PCDCommands.Item(iCnt)
    
    If (PCDCommand.IsDCCFeature) or (PCDCommand.IsMeasuredFeature) Then
      retval = PCDCommand.SetExpression ([COLOR="#0000FF"]RChar[/COLOR], [COLOR="#FF0000"]THEO_Z[/COLOR], 0)
      retval = PCDCommand.SetExpression ([COLOR="#0000FF"]RChar[/COLOR], [COLOR="#FF0000"]TARG_Z[/COLOR], 0)
    End If
    PCDPartProgram.Refresh
    Next iCnt
    
    'Cleanup
    Set PCDCommands = Nothing
    Set PCDPartProgram = Nothing
    Set PCDPartPrograms = Nothing
    Set PCDApp = Nothing
    End Sub


    Use it on your own risk.

    It ONLY changes the feature coordinate - NOT the hit coordinate.
Children
No Data