hexagon logo

ask for help with "GetProbeOffsets"

How to use "GetProbeOffsets" ,who can help me with vb code?
Parents
  • 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]
Reply
  • 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]
Children
No Data