Using a variable in the Part Name field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using a variable in the Part Name field

    Hey guys,

    I was hoping one of you could help me with this. I want the "Part Name" field in PC-DMIS to use a variable, but I can't get it to work.

    In my sample program, I have an Input Comment asking the operator for the part name then I assign a variable to that input. I want the Part Name PC-DMIS uses to change based on that input.

    Code:
    PART NAME  : MYPARTNAME
    REV NUMBER :
    SER NUMBER :
    STATS COUNT : 1
    
    STARTUP    =ALIGNMENT/START,RECALL:USE_PART_SETUP,LIST=YES
                ALIGNMENT/END
                MODE/MANUAL
                FORMAT/TEXT,OPTIONS, ,HEADINGS,SYMBOLS, ;NOM,TOL,MEAS,DEV,OUTTOL, ,
                LOADPROBE/HEXAGON LEITZ SCANNING PROBE
                TIP/T1A0B0, SHANKIJK=0, 0, 1, ANGLE=0
                MODE/DCC
                ASSIGN/V1=GETPROGRAMINFO("date")
    C1         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                HOW MANY PARTS ARE YOU RUNNING?
    C2         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                PLEASE ENTER PART NAME
                ASSIGN/V2=C1.INPUT
                ASSIGN/MYPARTNAME=C2.INPUT
    CMMXYZ Applications Specialist: PC-DMIS Support and Training. Check out my PC-DMIS tutorial videos... https://blog.cmmxyz.com/blog/tag/cmm-tech-tips

  • #2
    AFAIK you can't.

    You can do it via a script however.
    Automettech - Automated Metrology Technology

    Comment


    • #3
      As NinjaBadger wrote, you can do it via script. Below you can take inspiration from simple script GET_VARIABLE.BAS

      Script code looks like this:

      Sub Main
      Dim App As Object
      Set App = CreateObject ("PCDLRN.Application")
      Dim Part As Object
      Set Part = App.ActivePartProgram
      Dim Var As Object
      Set Var = Part.GetVariableValue ("V102")

      Dim RevNumber As String
      RevNumber = Var.StringValue
      Part.RevisionNumber = RevNumber

      End Sub


      In my case the script rewrite REVNUMBER. For your case a basic script code will be very similar. Part of code from my PCDMIS routine is following.

      C102 =COMMENT/INPUT,NO,FULL SCREEN=YES,
      'Zakázka'
      C103 =COMMENT/INPUT,NO,FULL SCREEN=YES,
      Pořadové číslo kusu
      v zakázce
      ASSIGN/V100=C100.INPUT
      ASSIGN/V102=C102.INPUT
      ASSIGN/V103=C103.INPUT
      ASSIGN/V104=GETPROGRAMINFO("SERIALNUM")
      CS1 =SCRIPT/FILENAME= C:\USERS\PUBLIC\DOCUMENTS\HEXAGON\PC-DMIS\BASIC\GET_VARIABLE.BAS
      FUNCTION/Main,SHOW=YES,,
      STARTSCRIPT/
      ENDSCRIPT/

      I hope it helps to you

      Comment


      • #4
        This script will allow you to set any of the program header fields (partname, revision number or serial number)

        Code:
        ' this script will change the PART Name In the edit window header To whatever is passed In As arg1 from PC-Dmis
        ' the REV NUMBER In the edit window header To whatever is passed In As arg2 from PC-Dmis
        ' the SER NUMBER In the edit window header To whatever is passed In As arg3 from PC-Dmis
        '
        Dim PCDapp As Object
        Dim PP As Object
        '
        'defines "pname" As String And sets As ARG1 from script command In PCD prog
        'defines "revis" As String And sets As ARG2 from script command In PCD prog
        'defines "sernum" As String And sets As ARG3 from script command In PCD prog
        '
        Sub Main (pname As String,revis As String,sernum As String)
        Set PCDapp=createObject("PCDLRN.Application")
        Set PP=PCDapp.ActivePartProgram
        
        If pname = "" Then GoTo 1
        PP.PARTNAME=pname
        1:
        If revis = "" Then GoTo 2
        PP.revisionnumber=revis
        2:
        If sernum = "" Then GoTo 3
        pp.serialnumber=sernum
        3:
        PP.REFRESHPART
        
        Set PCDapp = Nothing
        Set PP = Nothing
        End Sub

        Before running the .prg, it will look like this...

        Code:
        PART NAME : old_prg_name
        REV NUMBER :
        SER NUMBER :
        STATS COUNT : 1
        
        STARTUP =ALIGNMENT/START,RECALL:USE_PART_SETUP,LIST=YES
        ALIGNMENT/END
        MODE/MANUAL
        PREHIT/0.5
        RETRACT/0.5
        MOVESPEED/ 500
        TOUCHSPEED/ 4
        FLY/ON
        FORMAT/TEXT,OPTIONS, ,HEADINGS,SYMBOLS, ;NOM,TOL,MEAS,DEV,OUTTOL, ,
        LOADPROBE/NEW5_BY_50
        TIP/T1A0B0, SHANKIJK=0, 0, 1, ANGLE=0
        CS1 =SCRIPT/FILENAME= D:\VB STUFF\HEADER.BAS
        FUNCTION/Main,SHOW=YES,ARG1="my new part name",ARG2="001",ARG3="123456",,
        STARTSCRIPT/
        ENDSCRIPT/
        After the script has been executed, it will look like this...

        Code:
        PART NAME : my new part name
        REV NUMBER : 001
        SER NUMBER : 123456
        STATS COUNT : 1
        
        STARTUP =ALIGNMENT/START,RECALL:USE_PART_SETUP,LIST=YES
        ALIGNMENT/END
        MODE/MANUAL
        PREHIT/0.5
        RETRACT/0.5
        MOVESPEED/ 500
        TOUCHSPEED/ 4
        FLY/ON
        FORMAT/TEXT,OPTIONS, ,HEADINGS,SYMBOLS, ;NOM,TOL,MEAS,DEV,OUTTOL, ,
        LOADPROBE/NEW5_BY_50
        TIP/T1A0B0, SHANKIJK=0, 0, 1, ANGLE=0
        CS1 =SCRIPT/FILENAME= D:\VB STUFF\HEADER.BAS
        FUNCTION/Main,SHOW=YES,ARG1="my new part name",ARG2="001",ARG3="123456",,
        STARTSCRIPT/
        ENDSCRIPT/
        Neil Challinor
        PC-DMIS Product Owner

        T: +44 870 446 2667 (Hexagon UK office)
        E: [email protected]

        Comment

        Related Topics

        Collapse

        Working...
        X