hexagon logo

ask for help with "GetProbeOffsets"

How to use "GetProbeOffsets" ,who can help me with vb code?
  • Public Sub GetProbeOffsets( _
       ByVal buffer As PointData _
    )
  • public sub getprobeoffsets( _
       byval buffer as pointdata _
    )

    would you please give me a sample code
  • I don't know how to use the specific "getprobeoffsets",would you give some sample codes,my email address is gsrchl@gmail.com ,thank you!
  • Sub Main
    Dim PCDApp, PCDPartPrograms, PCDPartProgram, PCDCommands, PCDPrbOffset
    Dim rad As Double
    
    Set PCDApp = CreateObject("PCDLRN.Application")
    Set PCDPartPrograms = PCDApp.PartPrograms
    Set PCDPartProgram = PCDApp.ActivePartProgram
    Set PCDPrbOffset = CreateObject("PCDLRN.PointData")
    Set PCDOB = PCDPartProgram.OldBasic
    
    PCDOB.GetProbeOffsets(PCDPrbOffset)
    rad=PCDOB.GetProbeRadius
    MsgBox(rad)
    
    Set PCDCommands = Nothing
    Set PCDPartProgram = Nothing
    Set PCDPartPrograms = Nothing
    Set PCDApp = Nothing
    Set PCDPrbOffset = Nothing
    Set PCDOB = Nothing
    End Sub


    This should allow us to access the properties from the GetProbeOffsets, but everytime I run this, it crashes PC-DMIS.
    Either my code is wrong (there isn't many examples in the helpfile...) or this is a bug.

    Let's hope some one more fluent with this peeks in here and can help.

    The GetProbeRadius works fine though.
  • This should allow us to access the properties from the GetProbeOffsets, but everytime I run this, it crashes PC-DMIS.


    When I try to use GetProbeOffsets from the VB6 IDE, it doesn't crash pc-dmis, but I do get a "Type Mismatch" run-time error when calling the sub(passing an object declared as PointData). So either my code is wrong too, or something is amiss here.

    @geshengrong:
    Not sure what your specific needs are, but it is possible to get the offsets of the current probe tip using pc-dmis function in the part program.

    ASSIGN/V1=PROBEDATA("OFFSET","") returns XYZ offsets for the active tip

    ASSIGN/V1=PROBEDATA("OFFSET","T1A45B135") returns XYZ offsets for the tip named in the 2nd parameter.

    Then use V1.X, V1.Y, V1.Z to get to the XYZ values.

    If you need to get the offsets by script, here is VB sample code that shows the object hierarchy to get the offsets from the TIP object, instead of using the OldBasic object:
    [SIZE=2][FONT=courier new][COLOR=#000000]Sub Main()[/COLOR]
    [COLOR=#000000]  Dim pcd As Application[/COLOR]
    [COLOR=#000000]  Dim pd As PointData[/COLOR]
    
    [COLOR=#000000]  Set pcd = CreateObject("PCDLRN.Application", "")[/COLOR]
    [COLOR=#000000]  Set pd = CreateObject("PCDLRN.PointData", "")[/COLOR]
    
    [COLOR=#000000]  Set pd = pcd.ActivePartProgram.Probes(pcd.ActivePartProgram.CurrentProbeName).Tips("T1A0B0").XYZ[/COLOR]
    
    [COLOR=#000000]  MsgBox (pd.X & "," & pd.Y & "," & pd.Z)[/COLOR]
    [/FONT][/SIZE][FONT=Arial][SIZE=3][COLOR=#000000][SIZE=2][FONT=courier new]End Sub[/FONT][/SIZE]
    [/COLOR][/SIZE][/FONT]
  • @DJAMS:
    Set pd = pcd.ActivePartProgram.Probes(pcd.ActivePartProgram.CurrentProbeName).Tips("T1A0B0").XYZ

    "T1A0B0" is not active tip,could you tell how to get the active tip at currentcommand line like this ASSIGN/V1=PROBEDATA("OFFSET","") returns XYZ offsets for the active tip
  • @DJAMS:
    Set pd = pcd.ActivePartProgram.Probes(pcd.ActivePartProgram.CurrentProbeName).Tips("T1A0B0").XYZ

    "T1A0B0" is not active tip,could you tell how to get the active tip at currentcommand line like this ASSIGN/V1=PROBEDATA("OFFSET","") returns XYZ offsets for the active tip


    I looked around for an easy way to do that yesterday, but didn't find one.

    I can think of a couple of possibilities, neither of which is really simple.

    Perhaps if you could share what it is you are trying to accomplish (the end goal) - it would help us come up with the best solution.
  • Sorry about the necrobump, this came up in a search for something else.

    Did this have an issue because you tried to dimension a reserved keyword (RAD)? Is RAD reserved?
  • Sorry, no clue, I didn't pursue it further.