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
  • Could you try to re-phrase your question? I am having a hard time to understand what you are asking.
  • Sorry
    use the W instead of the Feature of the Z coordinate values
    Could you try to re-phrase your question? I am having a hard time to understand what you are asking.
  • What is W??? You mean as in U,V,W? The W vector?
  • PNT2 =FEAT/POINT,RECT
    THEO/-45,3.075,-3,1,0,0
    ACTL/-45,3.075,-3,1,0,0
    MEAS/POINT,1
    MOVE/CLEARPLANE
    HIT/BASIC,NORMAL,-45,3.075,-3,1,0,0,-45,3.075,-3,USE THEO = YES
    ENDMEAS/
    PNT3 =FEAT/POINT,RECT
    THEO/-30,22.084,-3,1,0,0
    ACTL/-30,22.084,-3,1,0,0
    MEAS/POINT,1
    MOVE/CLEARPLANE
    HIT/BASIC,NORMAL,-30,22.084,-3,1,0,0,-30,22.084,-3,USE THEO = YES
    ENDMEAS/
    PNT4 =FEAT/POINT,RECT
    THEO/-15,41.079,-3,1,0,0
    ACTL/-15,41.079,-3,1,0,0
    MEAS/POINT,1
    MOVE/CLEARPLANE
    HIT/BASIC,NORMAL,-15,41.079,-3,1,0,0,-15,41.079,-3,USE THEO = YES
    ENDMEAS/


    PNT2 =FEAT/POINT,RECT
    THEO/-45,3.075,W,1,0,0
    ACTL/-45,3.075,-3,1,0,0
    MEAS/POINT,1
    MOVE/CLEARPLANE
    HIT/BASIC,NORMAL,-45,3.075,W,1,0,0,-45,3.075,-3,USE THEO = YES
    ENDMEAS/
    PNT3 =FEAT/POINT,RECT
    THEO/-30,22.084,W,1,0,0
    ACTL/-30,22.084,-3,1,0,0
    MEAS/POINT,1
    MOVE/CLEARPLANE
    HIT/BASIC,NORMAL,-30,22.084,W,1,0,0,-30,22.084,-3,USE THEO = YES
    ENDMEAS/
    PNT4 =FEAT/POINT,RECT
    THEO/-15,41.079,W,1,0,0
    ACTL/-15,41.079,-3,1,0,0
    MEAS/POINT,1
    MOVE/CLEARPLANE
    HIT/BASIC,NORMAL,-15,41.079,W,1,0,0,-15,41.079,-3,USE THEO = YES
    ENDMEAS/
    Basic Script ,help me!
  • You want to use a variable (W) instead of an actual value?

    If so, you must assign a value to the variable:

    ASSIGN/W=-3
  • You want to use a variable (W) instead of an actual value?

    If so, you must assign a value to the variable:

    ASSIGN/W=-3

    Use the Basic Script Editor to achieve with this function, rather than to manually change the code
    how to write the code?
  • ' 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.
  • ' 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.


    Thank you very much ,you are so powerful, it really can achieve