hexagon logo

Set an active tip via code

Hi,

Does anybody have implemented setting an active tip via code?
It is equivalent to select a new tip from the Probe Tips pull-down list on PC-DMIS UI.

I am trying to do this using the following command, but I am not sure the suitable parameters.

objCommand = objPartProgram.Commands.Add(OBTYPE.SET_ACTIVE_TIP, true);

Please advise.​
  • Create a program where you do the things you want to know the syntax for in your script.
    Export this part program as BASIC.
    Open the exported basic routine in Notepad or another texteditor to see how the part program looks like in BASIC (and re-use the code in your script).
  • Thank you so much for your reply.
    It is super useful information for me since I am a beginner of coding for PC-DMIS.

    I successfully executed what I need!

    Thanks again!​
  • Can you share what you did please? I'm curious as well to understand this.
  • This is what I did...

    1. Export the fundamental command(s) from PC-DMIS as BASIC script​

    Set DmisCommand = DmisCommands.Add(SET_ACTIVE_TIP, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Id = T1A0B0
    retval = DmisCommand.PutText ("T1A0B0", REF_ID, 0)
    ' Set Tip I = 0
    retval = DmisCommand.PutText ("0", TIP_I, 0)
    ' Set Tip J = 0
    retval = DmisCommand.PutText ("0", TIP_J, 0)
    ' Set Tip K = 1
    retval = DmisCommand.PutText ("1", TIP_K, 0)
    ' Set Theoretical Angle = 0
    retval = DmisCommand.PutText ("0", THEO_ANGLE, 0)​


    2. Find the constants in Visual Studio

    3. Migrate the code to Python

    PCD_OBTYPE_SET_ACTIVE_TIP = 60
    PCD_ENUM_FIELD_TYPES_REF_ID = 3
    PCD_ENUM_FIELD_TYPES_TIP_I = 229
    PCD_ENUM_FIELD_TYPES_TIP_J = 230
    PCD_ENUM_FIELD_TYPES_TIP_K = 231
    PCD_ENUM_FIELD_TYPES_THEO_ANGLE = 38​

    command = program.Commands.Add(PCD_OBTYPE_SET_ACTIVE_TIP, True)
    commandRet = command.PutText('T1A0B0', PCD_ENUM_FIELD_TYPES_REF_ID, 0)
    commandRet = command.EXECUTE​​
  • THIS^^^ was a game changer for me.