hexagon logo

Ring Plane Basic Script

Here is a script I just wrote to create a ring plane it can do 1 or more rings starting and ending at specified diameters

Attached Files
  • Here is my edited version for DCC ring plane:

    Sub Main

    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

    Dim PLN_ID$
    Dim X#(99), Y#(99), Z#(99)
    Dim i%, j%
    Dim HDirection%, Hpattern%, NHits%, NHitsRing%, NRings%, hit%, buttonval%
    Dim HitAngle#, HitAngleInc#, SRadius#, ERadius#, RadiusInc#
    Dim X_theo#, Y_theo#, Z_theo#, Xtheo#, Ytheo#

    Const PI = 3.141592654
    HDirection = 0
    Hpattern = 0
    NHits = 0
    NHitsRing = 0
    HitAngle = 0
    HitAngleInc = 0
    NRings = 0
    SRadius = 0
    ERadius = 0
    RadiusInc = 0

    X_theo = 0
    Y_theo = 0
    Z_theo = 0
    Xtheo = 0
    Ytheo = 0

    Begin Dialog DLG_RING_PLANE 106,15,163,177, "Ring Plane"

    TextBox 2, 1,40,10, .EditBox_1
    Text 45,1,55,10, "PLN ID"
    TextBox 2,14,35,10, .EditBox_2
    Text 45,14,55,10, "X Origin"
    TextBox 2,27,35,10, .EditBox_3
    Text 45,27,55,10, "Y Origin"
    TextBox 2,40,35,10, .EditBox_4
    Text 45,40,55,10, "Z Origin"
    TextBox 2,53,35,10, .EditBox_5
    Text 45,53,55,10, "Number of Rings"
    TextBox 2,75,35,10, .EditBox_6
    Text 45,75,55,10, "Start Diameter"
    TextBox 2,88,35,10, .EditBox_7
    Text 45,88,55,10, "End Diameter"
    TextBox 2,103,35,10, .EditBox_8
    Text 45,103,55,10, "Hits Per Ring"
    TextBox 2,118,35,10, .EditBox_9
    Text 45,118, 55,10, "Start Angle"

    GroupBox 95,1,55,45, "Hit Pattern", .GroupBox1
    GroupBox 95,75,55,45, "Hit Direction", .GroupBox2

    OptionGroup .OptionGroup1
    OptionButton 100,17,40,8, "Radial", .OptionButton1
    OptionButton 100, 28,40,8, "Orbital", .OptionButton2

    OptionGroup .OptionGroup2
    OptionButton 100, 91,40,8, "CW", .OptionButton3
    OptionButton 100, 102, 40,8, "CCW", .OptionButton4

    OKButton 30,160,44,12
    CancelButton 82,160,52,12
    End Dialog

    Dim dlg1 As DLG_RING_PLANE
    buttonval = Dialog(dlg1)

    PLN_ID = dlg1.EditBox_1
    X_theo = dlg1.EditBox_2
    Y_theo = dlg1.EditBox_3
    Z_theo = dlg1.EditBox_4
    NRings = dlg1.EditBox_5
    SRadius = dlg1.EditBox_6/2
    ERadius = dlg1.EditBox_7/2
    NHitsRing = dlg1.EditBox_8
    NHits = NRings * NHitsRing
    HitAngle = 0
    HitAngleInc = (2*PI) / NHitsRing

    If NRings > 1 Then
    RadiusInc = (ERadius - SRadius) / (NRings - 1)
    Else
    RadiusInc = 0
    End If

    If dlg1.EditBox_9 <> 0 Then
    If dlg1.EditBox_9 < 0 Then
    dlg1.EditBox_9 = 360 + dlg1.EditBox_9
    End If
    HitAngle = dlg1.EditBox_9*(PI/180)
    End If

    If dlg1.OptionGroup2 = 1 Then
    HDirection = 1
    End If

    If dlg1.OptionGroup1 = 1 Then
    Hpattern = 1
    End If

    hit = 1

    If Hpattern = 1 Then ' Orbital
    For i = 1 To NRings
    For j = 1 To NHitsRing

    If HDirection = 0 Then
    Xtheo = SRadius * cos(HitAngle) + X_theo
    Ytheo = SRadius * sin(HitAngle) + Y_theo
    Else
    Xtheo = X_theo + SRadius * cos(HitAngle)
    Ytheo = (Y_theo + SRadius * sin(HitAngle) ) * -1
    End If

    X(hit) = Xtheo
    Y(hit) = Ytheo

    hit = hit + 1
    HitAngle = HitAngle + HitAngleInc

    Next j

    HitAngle = HitAngle - HitAngleInc
    SRadius = SRadius + RadiusInc
    Next i

    Else ' If it is Not orbital it must be Radial
    For i = 1 To NHitsRing
    For j = 1 To NRings
    If HDirection = 0 Then
    Xtheo = SRadius * cos(HitAngle) + X_theo
    Ytheo = SRadius * sin(HitAngle) + Y_theo
    Else
    Xtheo = X_theo + SRadius * cos(HitAngle)
    Ytheo = (Y_theo + SRadius * sin(HitAngle)) * -1
    End If

    X(hit) = Xtheo
    Y(hit) = Ytheo
    hit = hit + 1
    SRadius = SRadius + RadiusInc

    Next j

    SRadius = SRadius - RadiusInc
    HitAngle = HitAngle - HitAngleInc
    RadiusInc = RadiusInc * -1

    Next i
    End If

    Set Cmd = Cmds.Add(CONTACT_PLANE_FEATURE, True)
    Cmd.Marked = True
    retval = Cmd.PutText (X_theo, THEO_X, 0)
    retval = Cmd.PutText (Y_theo, THEO_Y, 0)
    retval = Cmd.PutText (Z_theo, THEO_Z, 0)
    retval = Cmd.PutText ("0", THEO_I, 0)
    retval = Cmd.PutText ("0", THEO_J, 0)
    retval = Cmd.PutText ("1", THEO_K, 0)
    retval = Cmd.PutText ("0", ANGVEC_I, 0)
    retval = Cmd.PutText ("1", ANGVEC_J, 0)
    retval = Cmd.PutText ("0", ANGVEC_K, 0)
    retval = Cmd.PutText (X_theo, MEAS_X, 0)
    retval = Cmd.PutText (Y_theo, MEAS_Y, 0)
    retval = Cmd.PutText (Z_theo, MEAS_Z, 0)
    retval = Cmd.PutText ("0", MEAS_I, 0)
    retval = Cmd.PutText ("0", MEAS_J, 0)
    retval = Cmd.PutText ("1", MEAS_K, 0)
    retval = Cmd.PutText (X_theo, TARG_X, 0)
    retval = Cmd.PutText (Y_theo, TARG_Y, 0)
    retval = Cmd.PutText (Z_theo, TARG_Z, 0)
    retval = Cmd.PutText ("0", TARG_I, 0)
    retval = Cmd.PutText ("0", TARG_J, 0)
    retval = Cmd.PutText ("1", TARG_K, 0)
    retval = Cmd.PutText ("1", REPORTVEC_I, 0)
    retval = Cmd.PutText ("0", REPORTVEC_J, 0)
    retval = Cmd.PutText ("0", REPORTVEC_K, 0)
    retval = Cmd.PutText( PLN_ID, ID, 0)
    retval = Cmd.SetToggleString (1, COORD_TYPE, 0)
    retval = Cmd.SetToggleString (2, DISPLAY_TYPE,0)
    retval = Cmd.PutText(NHitsRing, N_HITS, 0)
    retval = Cmd.PutText(NRings, N_ROWS, 0)
    retval = Cmd.PutText ("DEFAULT", MEASUREMENT_STRATEGY, 0)
    'retval = Cmd.PutText ("<Current Alignment>", RMEASFEATIDX, 0) 'uncomment all if english version
    'retval = Cmd.PutText ("<Current Alignment>", RMEASFEATIDY, 0)
    'retval = Cmd.PutText ("<Current Alignment>", RMEASFEATIDZ, 0)
    retval = Cmd.SetToggleString (1, BF_MATH_TYPE, 0)
    retval = Cmd.SetToggleString (3, FIND_NOMS_TYPE, 0)
    retval = Cmd.SetToggleString (3, THICKNESS_TYPE, 0)
    retval = Cmd.PutText ("0", F_THICKNESS, 0)
    retval = Cmd.SetToggleString (2, DISPLAY_PROBE_PARAMETERS, 0)
    retval = Cmd.SetToggleString (2, DISPLAY_ADVANCED_PARAMETERS, 0)
    'retval = Cmd.PutText ("YES", DISPLAY_HITS, 0)
    'retval = Cmd.PutText("RADIAL", PATTERN_TYPE, 0)

    For i = 1 To hit
    retval = Cmd.SetToggleString (0, HIT_TYPE, i)
    retval = Cmd.PutText (X(i), THEO_X, i)
    retval = Cmd.PutText (Y(i), THEO_Y, i)
    retval = Cmd.PutText (Z_theo, THEO_Z, i)
    retval = Cmd.PutText ("0", THEO_I, i)
    retval = Cmd.PutText ("0", THEO_J, i)
    retval = Cmd.PutText ("1", THEO_K, i)
    retval = Cmd.PutText (X(i), MEAS_X, i)
    retval = Cmd.PutText (Y(i), MEAS_Y, i)
    retval = Cmd.PutText (Z_theo, MEAS_Z, i)
    retval = Cmd.PutText ("0", MEAS_I, i)
    retval = Cmd.PutText ("0", MEAS_J, i)
    retval = Cmd.PutText ("1", MEAS_K, i)
    Next i

    Cmd.ReDraw

    Set Cmd = Nothing
    Set Cmds = Nothing
    Set Part = Nothing
    Set App = Nothing

    End Sub
  • Here is my script to make DCC pattern plane.


    Sub Main

    Dim PCDapp As Object
    Dim PCDpart As Object
    Dim Cmds As Object
    Dim Cmd As Object
    Dim FCmd As Object

    Dim Lenght#, Width#
    Dim Rows%, RowHits%, NumHits%, hit%
    Dim tX#, tY#, tZ#, theo_X#, theo_Y#
    Dim theoX#(99), theoY#(99)
    Dim PlnID$, Direction$(3)
    Dim ButtonVal%, PattLenght#, PattWidth#
    Dim pdirection%, wdirection%, start_X#, start_Y#

    Set PCDapp = CreateObject("PCDLRN.Application")
    Set PCDpart = PCDapp.ActivePartProgram
    Set Cmds = PCDpart.Commands

    Direction(0) = "XPLUS"
    Direction(1) = "YPLUS"
    Direction(2) = "XMINUS"
    Direction(3) = "YMINUS"

    Begin Dialog DLG_PATTERN_PLANE 106,15,163,177, "Pattern Plane"
    TextBox 2, 1,40,10, .EditBox_1
    Text 45,1,55,10, "PLN ID"
    TextBox 2,14,35,10, .EditBox_2
    Text 45,14,55,10, "X Origin"
    TextBox 2,27,35,10, .EditBox_3
    Text 45,27,55,10, "Y Origin"
    TextBox 2,40,35,10, .EditBox_4
    Text 45,40,55,10, "Z Origin"
    TextBox 2,53,35,10, .EditBox_5
    Text 45,53,55,10, "Number of Rows"
    TextBox 2,75,35,10, .EditBox_6
    Text 45,75,55,10, "Lenght"
    TextBox 2,88,35,10, .EditBox_7
    Text 45,88,55,10, "Width"
    TextBox 2,103,35,10, .EditBox_8
    Text 45,103,55,10, "Hits Per Row"
    DropListBox 100,17,40,8, Direction$(), .dirListbox
    OKButton 30,160,44,12
    CancelButton 82,160,52,12
    End Dialog

    Dim dlg1 As DLG_PATTERN_PLANE

    dlg1.EditBox_1 = "PLN"
    dlg1.EditBox_2 = 0
    dlg1.EditBox_3 = 0
    dlg1.EditBox_4 = 0

    ButtonVal = Dialog(dlg1)

    If ButtonVal = -1 Then

    PlnID = dlg1.EditBox_1
    tX = dlg1.EditBox_2
    tY = dlg1.EditBox_3
    tZ = dlg1.EditBox_4
    RowHits = dlg1.EditBox_8
    Rows = dlg1.EditBox_5
    Lenght = dlg1.EditBox_6
    Width = dlg1.EditBox_7
    NumHits = Rows * RowHits
    PattLenght = Lenght/(RowHits - 1)
    PattWidth = Width/(Rows - 1)
    hit = 1

    pdirection = 0
    wdirection = 0

    If dlg1.dirListbox = 0 Or dlg1.dirListbox = 2 Then
    pdirection = 1
    ElseIf dlg1.dirListbox = 1 Or dlg1.dirListbox = 3 Then
    wdirection = 1
    End If

    If pdirection = 1 Then
    If dlg1.dirListbox = 0 Then
    start_X = tX + (Lenght/2)
    start_Y = tY + (Width/2)
    PattLenght = PattLenght * -1
    PattWidth = PattWidth * -1
    ElseIf dlg1.dirListbox = 2 Then
    start_X = (tX + (Lenght/2)) * -1
    start_Y = (tY + (Width/2)) * -1
    End If
    Else
    If dlg1.dirListbox = 1 Then
    start_X = tX - (Width/2)
    start_Y = tY + (Lenght/2)
    PattLenght = PattLenght * -1
    ElseIf dlg1.dirListbox = 3 Then
    start_X = (tX - (Width/2)) * -1
    start_Y = (tY + (Lenght/2)) * -1
    PattWidth = PattWidth * -1
    End If
    End If

    theo_X = start_X
    theo_Y = start_Y

    If pdirection = 1 Then
    For i = 1 To Rows
    For h = 1 To RowHits
    theoX(hit) = theo_X
    theoY(hit) = theo_Y
    hit = hit + 1
    If h < RowHits Then
    theo_X = theo_X + PattLenght
    End If

    Next h
    theo_Y = theo_Y + PattWidth
    PattLenght = PattLenght * -1
    Next i
    ElseIf wdirection = 1 Then
    For i = 1 To Rows
    For h = 1 To RowHits
    theoX(hit) = theo_X
    theoY(hit) = theo_Y
    hit = hit + 1
    If h < RowHits Then
    theo_Y = theo_Y + PattLenght
    End If

    Next h
    theo_X = theo_X + PattWidth
    PattLenght = PattLenght * -1
    Next i
    End If

    Set Cmd = Cmds.CurrentCommand
    Cmds.InsertionPointAfter Cmd

    Set Cmd = Cmds.Add(CONTACT_PLANE_FEATURE, True)
    Cmd.Marked = True
    retval = Cmd.PutText (tX, THEO_X, 0)
    retval = Cmd.PutText (tY, THEO_Y, 0)
    retval = Cmd.PutText (tZ, THEO_Z, 0)
    retval = Cmd.PutText ("0", THEO_I, 0)
    retval = Cmd.PutText ("0", THEO_J, 0)
    retval = Cmd.PutText ("1", THEO_K, 0)
    retval = Cmd.PutText ("0", ANGVEC_I, 0)
    retval = Cmd.PutText ("1", ANGVEC_J, 0)
    retval = Cmd.PutText ("0", ANGVEC_K, 0)
    retval = Cmd.PutText (tX, MEAS_X, 0)
    retval = Cmd.PutText (tY, MEAS_Y, 0)
    retval = Cmd.PutText (tZ, MEAS_Z, 0)
    retval = Cmd.PutText ("0", MEAS_I, 0)
    retval = Cmd.PutText ("0", MEAS_J, 0)
    retval = Cmd.PutText ("1", MEAS_K, 0)
    retval = Cmd.PutText (tX, TARG_X, 0)
    retval = Cmd.PutText (tY, TARG_Y, 0)
    retval = Cmd.PutText (tZ, TARG_Z, 0)
    retval = Cmd.PutText ("0", TARG_I, 0)
    retval = Cmd.PutText ("0", TARG_J, 0)
    retval = Cmd.PutText ("1", TARG_K, 0)
    retval = Cmd.PutText ("1", REPORTVEC_I, 0)
    retval = Cmd.PutText ("0", REPORTVEC_J, 0)
    retval = Cmd.PutText ("0", REPORTVEC_K, 0)
    retval = Cmd.PutText(PlnID, ID, 0)
    retval = Cmd.SetToggleString (1, COORD_TYPE, 0)
    retval = Cmd.SetToggleString (2, DISPLAY_TYPE,0)
    retval = Cmd.PutText(RowHits, N_HITS, 0)
    retval = Cmd.PutText(Rows, N_ROWS, 0)
    If PattLenght > 0 Then
    retval = Cmd.PutText(PattLenght, F_SPACER, 0)
    Else
    retval = Cmd.PutText((PattLenght * -1), F_SPACER, 0)
    End If
    retval = Cmd.SetToggleString (1, BF_MATH_TYPE, 0)
    retval = Cmd.SetToggleString (3, FIND_NOMS_TYPE, 0)
    retval = Cmd.SetToggleString (3, THICKNESS_TYPE, 0)
    retval = Cmd.PutText ("0", F_THICKNESS, 0)
    retval = Cmd.SetToggleString (2, DISPLAY_PROBE_PARAMETERS, 0)
    retval = Cmd.SetToggleString (2, DISPLAY_ADVANCED_PARAMETERS, 0)


    For i = 1 To hit
    retval = Cmd.SetToggleString (0, HIT_TYPE, i)
    retval = Cmd.PutText (theoX(i), THEO_X, i)
    retval = Cmd.PutText (theoY(i), THEO_Y, i)
    retval = Cmd.PutText (tZ, THEO_Z, i)
    retval = Cmd.PutText ("0", THEO_I, i)
    retval = Cmd.PutText ("0", THEO_J, i)
    retval = Cmd.PutText ("1", THEO_K, i)
    retval = Cmd.PutText (theoX(i), MEAS_X, i)
    retval = Cmd.PutText (theoY(i), MEAS_Y, i)
    retval = Cmd.PutText (tZ, MEAS_Z, i)
    retval = Cmd.PutText ("0", MEAS_I, i)
    retval = Cmd.PutText ("0", MEAS_J, i)
    retval = Cmd.PutText ("1", MEAS_K, i)
    Next i

    Cmd.Redraw
    PCDpart.RefreshPart

    Set FCmd = Cmd.FeatureCommand
    For i = 1 To hit
    retval = FCmd.SetHit (i, FHITDATA_CENTROID, FDATA_THEO, theoX(i), theoY(i), tZ)
    Next i


    Cmd.Redraw

    End If

    Set Cmd = Nothing
    Set Cmds = Nothing
    Set FCmd = Nothing
    Set PCDpart = Nothing
    Set PCDapp = Nothing

    End Sub
  • Fixed Bugs with direction when x and y are not zero, and feature theo x y values are not updated

    Sub Main

    Dim PCDapp As Object
    Dim PCDpart As Object
    Dim Cmds As Object
    Dim Cmd As Object
    Dim FCmd As Object

    Dim Lenght#, Width#
    Dim Rows%, RowHits%, NumHits%, hit%
    Dim tX#, tY#, tZ#, theo_X#, theo_Y#
    Dim theoX#(99), theoY#(99)
    Dim PlnID$, Direction$(3)
    Dim ButtonVal%, PattLenght#, PattWidth#
    Dim pdirection%, wdirection%, start_X#, start_Y#

    Set PCDapp = CreateObject("PCDLRN.Application")
    Set PCDpart = PCDapp.ActivePartProgram
    Set Cmds = PCDpart.Commands

    Direction(0) = "XPLUS"
    Direction(1) = "YPLUS"
    Direction(2) = "XMINUS"
    Direction(3) = "YMINUS"

    Begin Dialog DLG_PATTERN_PLANE 106,15,163,177, "Pattern Plane"
    TextBox 2, 1,40,10, .EditBox_1
    Text 45,1,55,10, "PLN ID"
    TextBox 2,14,35,10, .EditBox_2
    Text 45,14,55,10, "X Origin"
    TextBox 2,27,35,10, .EditBox_3
    Text 45,27,55,10, "Y Origin"
    TextBox 2,40,35,10, .EditBox_4
    Text 45,40,55,10, "Z Origin"
    TextBox 2,53,35,10, .EditBox_5
    Text 45,53,55,10, "Number of Rows"
    TextBox 2,75,35,10, .EditBox_6
    Text 45,75,55,10, "Lenght"
    TextBox 2,88,35,10, .EditBox_7
    Text 45,88,55,10, "Width"
    TextBox 2,103,35,10, .EditBox_8
    Text 45,103,55,10, "Hits Per Row"
    DropListBox 100,17,40,8, Direction$(), .dirListbox
    OKButton 30,160,44,12
    CancelButton 82,160,52,12
    End Dialog

    Dim dlg1 As DLG_PATTERN_PLANE

    dlg1.EditBox_1 = "PLN"
    dlg1.EditBox_2 = 0
    dlg1.EditBox_3 = 0
    dlg1.EditBox_4 = 0

    ButtonVal = Dialog(dlg1)

    PlnID = dlg1.EditBox_1
    tX = dlg1.EditBox_2
    tY = dlg1.EditBox_3
    tZ = dlg1.EditBox_4
    RowHits = dlg1.EditBox_8
    Rows = dlg1.EditBox_5
    Lenght = dlg1.EditBox_6
    Width = dlg1.EditBox_7
    NumHits = Rows * RowHits
    PattLenght = Lenght/(RowHits - 1)
    PattWidth = Width/(Rows - 1)
    hit = 1

    pdirection = 0
    wdirection = 0

    If dlg1.dirListbox = 0 Or dlg1.dirListbox = 2 Then
    pdirection = 1
    ElseIf dlg1.dirListbox = 1 Or dlg1.dirListbox = 3 Then
    wdirection = 1
    End If

    If pdirection = 1 Then
    If dlg1.dirListbox = 0 Then
    start_X = tX + (Lenght/2)
    start_Y = tY + (Width/2)
    PattLenght = PattLenght * -1
    PattWidth = PattWidth * -1
    ElseIf dlg1.dirListbox = 2 Then
    start_X = (tX - (Lenght/2))
    start_Y = (tY - (Width/2))
    End If
    Else
    If dlg1.dirListbox = 1 Then
    start_X = tX - (Width/2)
    start_Y = tY + (Lenght/2)
    PattLenght = PattLenght * -1
    ElseIf dlg1.dirListbox = 3 Then
    start_X = (tX + (Width/2))
    start_Y = (tY - (Lenght/2))
    PattWidth = PattWidth * -1
    End If
    End If

    theo_X = start_X
    theo_Y = start_Y

    If pdirection = 1 Then
    For i = 1 To Rows
    For h = 1 To RowHits
    theoX(hit) = theo_X
    theoY(hit) = theo_Y
    hit = hit + 1
    If h < RowHits Then
    theo_X = theo_X + PattLenght
    End If

    Next h
    theo_Y = theo_Y + PattWidth
    PattLenght = PattLenght * -1
    Next i
    ElseIf wdirection = 1 Then
    For i = 1 To Rows
    For h = 1 To RowHits
    theoX(hit) = theo_X
    theoY(hit) = theo_Y
    hit = hit + 1
    If h < RowHits Then
    theo_Y = theo_Y + PattLenght
    End If

    Next h
    theo_X = theo_X + PattWidth
    PattLenght = PattLenght * -1
    Next i
    End If

    If ButtonVal = -1 Then

    Set Cmd = Cmds.CurrentCommand
    Cmds.InsertionPointAfter Cmd

    Set Cmd = Cmds.Add(CONTACT_PLANE_FEATURE, True)
    Cmd.Marked = True
    retval = Cmd.PutText (tX, THEO_X, 0)
    retval = Cmd.PutText (tY, THEO_Y, 0)
    retval = Cmd.PutText (tZ, THEO_Z, 0)
    retval = Cmd.PutText ("0", THEO_I, 0)
    retval = Cmd.PutText ("0", THEO_J, 0)
    retval = Cmd.PutText ("1", THEO_K, 0)
    retval = Cmd.PutText ("0", ANGVEC_I, 0)
    retval = Cmd.PutText ("1", ANGVEC_J, 0)
    retval = Cmd.PutText ("0", ANGVEC_K, 0)
    retval = Cmd.PutText (tX, MEAS_X, 0)
    retval = Cmd.PutText (tY, MEAS_Y, 0)
    retval = Cmd.PutText (tZ, MEAS_Z, 0)
    retval = Cmd.PutText ("0", MEAS_I, 0)
    retval = Cmd.PutText ("0", MEAS_J, 0)
    retval = Cmd.PutText ("1", MEAS_K, 0)
    retval = Cmd.PutText (tX, TARG_X, 0)
    retval = Cmd.PutText (tY, TARG_Y, 0)
    retval = Cmd.PutText (tZ, TARG_Z, 0)
    retval = Cmd.PutText ("0", TARG_I, 0)
    retval = Cmd.PutText ("0", TARG_J, 0)
    retval = Cmd.PutText ("1", TARG_K, 0)
    retval = Cmd.PutText ("1", REPORTVEC_I, 0)
    retval = Cmd.PutText ("0", REPORTVEC_J, 0)
    retval = Cmd.PutText ("0", REPORTVEC_K, 0)
    retval = Cmd.PutText(PlnID, ID, 0)
    retval = Cmd.SetToggleString (1, COORD_TYPE, 0)
    retval = Cmd.SetToggleString (2, DISPLAY_TYPE,0)
    retval = Cmd.PutText(RowHits, N_HITS, 0)
    retval = Cmd.PutText(Rows, N_ROWS, 0)
    If PattLenght > 0 Then
    retval = Cmd.PutText(PattLenght, F_SPACER, 0)
    Else
    retval = Cmd.PutText((PattLenght * -1), F_SPACER, 0)
    End If
    retval = Cmd.SetToggleString (1, BF_MATH_TYPE, 0)
    retval = Cmd.SetToggleString (3, FIND_NOMS_TYPE, 0)
    retval = Cmd.SetToggleString (3, THICKNESS_TYPE, 0)
    retval = Cmd.PutText ("0", F_THICKNESS, 0)
    retval = Cmd.SetToggleString (2, DISPLAY_PROBE_PARAMETERS, 0)
    retval = Cmd.SetToggleString (2, DISPLAY_ADVANCED_PARAMETERS, 0)

    For i = 1 To hit
    retval = Cmd.SetToggleString (0, HIT_TYPE, i)
    retval = Cmd.PutText (theoX(i), THEO_X, i)
    retval = Cmd.PutText (theoY(i), THEO_Y, i)
    retval = Cmd.PutText (tZ, THEO_Z, i)
    retval = Cmd.PutText ("0", THEO_I, i)
    retval = Cmd.PutText ("0", THEO_J, i)
    retval = Cmd.PutText ("1", THEO_K, i)
    retval = Cmd.PutText (theoX(i), MEAS_X, i)
    retval = Cmd.PutText (theoY(i), MEAS_Y, i)
    retval = Cmd.PutText (tZ, MEAS_Z, i)
    retval = Cmd.PutText ("0", MEAS_I, i)
    retval = Cmd.PutText ("0", MEAS_J, i)
    retval = Cmd.PutText ("1", MEAS_K, i)
    Next i

    Set FCmd = Cmd.FeatureCommand

    FCmd.PutPoint FHITDATA_CENTROID, FDATA_THEO, tX, tY, tZ

    For i = 1 To hit
    retval = FCmd.SetHit (i, FHITDATA_CENTROID, FDATA_THEO, theoX(i), theoY(i), tZ)
    Next i

    Cmd.Redraw
    PCDpart.RefreshPart

    End If

    Set Cmd = Nothing
    Set Cmds = Nothing
    Set FCmd = Nothing
    Set PCDpart = Nothing
    Set PCDapp = Nothing

    End Sub